Skip to content

Commit 9ace076

Browse files
committed
Update tests to use any_matches
1 parent 54adaee commit 9ace076

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tests/integration/expectations/operations/test_dataset.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ def test_duplicate_geometry_check(dataset_path):
281281
conn.close()
282282

283283
assert not result
284-
assert message == "There are 1 complete matches and 2 single matches in the dataset"
285-
assert details["actual"] == 3
284+
assert message == "There are 1 complete matches, 2 single matches and 3 any matches in the dataset"
285+
assert details["actual"] == 6
286286
assert details["expected"] == 0
287287

288288
assert details["complete_matches"][0]["entity_a"] == 1
@@ -295,7 +295,7 @@ def test_duplicate_geometry_check(dataset_path):
295295
assert details["single_matches"][1]["organisation_entity_a"] == 101
296296
assert details["single_matches"][1]["organisation_entity_b"] == 102
297297

298-
# entity 4 shouldn't have any duplicates
298+
# entity 4 has partial overlap with entities 1, 2 and 3 - flagged as any_match only
299299
assert not any(
300300
row["entity_a"] == 4 or row["entity_b"] == 4
301301
for row in details["complete_matches"]
@@ -304,6 +304,10 @@ def test_duplicate_geometry_check(dataset_path):
304304
row["entity_a"] == 4 or row["entity_b"] == 4
305305
for row in details["single_matches"]
306306
)
307+
assert any(
308+
row["entity_a"] == 4 or row["entity_b"] == 4
309+
for row in details["any_matches"]
310+
)
307311

308312

309313
def test_duplicate_geometry_check_point(dataset_path):
@@ -362,7 +366,7 @@ def test_duplicate_geometry_check_no_dupes(dataset_path):
362366
},
363367
{
364368
"entity": 4,
365-
"geometry": "POLYGON((1 1, 1 3, 3 3, 3 1, 1 1))",
369+
"geometry": "POLYGON((3 3, 3 5, 5 5, 5 3, 3 3))", # no overlap with entity 1
366370
"organisation_entity": 103,
367371
},
368372
]
@@ -381,5 +385,6 @@ def test_duplicate_geometry_check_no_dupes(dataset_path):
381385
assert message == "There are no duplicate geometries/points in the dataset"
382386
assert not details["complete_matches"]
383387
assert not details["single_matches"]
388+
assert not details["any_matches"]
384389
assert details["actual"] == 0
385390
assert details["expected"] == 0

0 commit comments

Comments
 (0)