From b7dc75d14de057b23209ea968fe4b3b9ac1fe203 Mon Sep 17 00:00:00 2001 From: William Silversmith Date: Sun, 17 Nov 2024 02:14:43 -0500 Subject: [PATCH] test: allow substitutions of equal value in largest_k --- automated_test.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/automated_test.py b/automated_test.py index d41c1fa..7adf59b 100644 --- a/automated_test.py +++ b/automated_test.py @@ -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):