Skip to content

Commit

Permalink
black check
Browse files Browse the repository at this point in the history
  • Loading branch information
kena-SL committed Jan 23, 2025
1 parent c52f25d commit 7450d6b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions digital_land/expectations/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def count_deleted_entities(
resource_list = get_resource["resource"].to_list()

# use resource list to get current entities
query = f"""select e.reference,fe.entry_number,f.entity,e.name,e.organisation_entity
query = f"""select f.entity
from fact_resource fe join fact f on fe.fact=f.fact join entity e on f.entity=e.entity
where resource in ({','.join(f"'{x}'" for x in resource_list)})
group by reference
Expand All @@ -156,7 +156,7 @@ def count_deleted_entities(

# get entities from entity table to compare against resource entities
query = f"""
select reference from entity where organisation_entity = '{organisation_entity}';
select entity from entity where organisation_entity = '{organisation_entity}';
"""
rows = conn.execute(query).fetchall()
get_entities = [row[0] for row in rows]
Expand Down
13 changes: 7 additions & 6 deletions tests/integration/expectations/test_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ def test_count_deleted_entities(dataset_path, mocker):
# load data into sqlite for entity, fact_resource and fact table
test_entity_data = pd.DataFrame.from_dict(
{
"entity": ["1001"],
"name": ["test1"],
"organisation_entity": [109],
"reference": ["ref1"],
"entity": ["1001", "1002"],
"name": ["test1", "test2"],
"organisation_entity": [109, 109],
"reference": ["ref1", "ref2"],
}
)

Expand Down Expand Up @@ -166,10 +166,11 @@ def test_count_deleted_entities(dataset_path, mocker):
)

assert (
passed
not passed
), f"test failed : expected {details['expected']} but got {details['actual']} entities"
assert message, "test requires a message"

detail_keys = ["actual", "expected"]
detail_keys = ["actual", "expected", "entities"]
for key in detail_keys:
assert key in details, f"{key} missing from details"
assert "1002" in details["entities"]

0 comments on commit 7450d6b

Please sign in to comment.