Skip to content

Commit

Permalink
test: allow substitutions of equal value in largest_k
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed Nov 17, 2024
1 parent 3dcd92b commit b7dc75d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion automated_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,18 @@ def test_largest_k(k):
if retained_labels[0] == 0:
retained_labels = retained_labels[1:]

assert np.all(lbls == retained_labels)
# allow for differences if they are of equal magnitude
diffs = np.array(list(set(lbls).difference(set(retained_labels))), dtype=int)
diffs2 = np.array(list(set(retained_labels).difference(set(lbls))), dtype=int)

diffs = cts[diffs]
diffs2 = cts[diffs2]

diffs.sort()
diffs2.sort()

assert np.all(diffs == diffs2)
assert len(lbls) == len(retained_labels)

@pytest.mark.parametrize("connectivity", [4,8])
def test_periodic_boundary_2d(connectivity):
Expand Down

0 comments on commit b7dc75d

Please sign in to comment.