Skip to content

Commit 8f641d2

Browse files
test: check in_place for spherical dilate
1 parent a66ba52 commit 8f641d2

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

automated_test.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,31 @@
55
import fastmorph
66
import scipy.ndimage
77

8-
def test_spherical_dilate():
8+
@pytest.mark.parametrize("in_place", [False, True])
9+
def test_spherical_dilate(in_place):
910
labels = np.zeros((10,10,10), dtype=bool)
10-
res = fastmorph.spherical_dilate(labels, radius=1000)
11+
res = fastmorph.spherical_dilate(labels, radius=1000, in_place=in_place)
1112
assert np.all(res == False)
1213

14+
labels = np.zeros((10,10,10), dtype=bool)
1315
labels[5,5,5] = True
1416
radius = 5 * np.sqrt(3) + 0.000001
15-
res = fastmorph.spherical_dilate(labels, radius=radius)
17+
res = fastmorph.spherical_dilate(labels, radius=radius, in_place=in_place)
1618
assert np.all(res == True)
1719

18-
res = fastmorph.spherical_dilate(labels, radius=1)
20+
labels = np.zeros((10,10,10), dtype=bool)
21+
labels[5,5,5] = True
22+
res = fastmorph.spherical_dilate(labels, radius=1, in_place=in_place)
1923
assert np.count_nonzero(res) == 7
2024

21-
res = fastmorph.spherical_dilate(labels, radius=np.sqrt(2))
25+
labels = np.zeros((10,10,10), dtype=bool)
26+
labels[5,5,5] = True
27+
res = fastmorph.spherical_dilate(labels, radius=np.sqrt(2), in_place=in_place)
2228
assert np.count_nonzero(res) == 19
23-
24-
res = fastmorph.spherical_dilate(labels, radius=np.sqrt(3))
29+
30+
labels = np.zeros((10,10,10), dtype=bool)
31+
labels[5,5,5] = True
32+
res = fastmorph.spherical_dilate(labels, radius=np.sqrt(3), in_place=in_place)
2533
assert np.count_nonzero(res) == 27
2634

2735
@pytest.mark.parametrize("in_place", [False, True])

0 commit comments

Comments
 (0)