From 26f6bd4fbafe2a73a5c928a78cea18b25ba6bbed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Wed, 15 Aug 2012 09:47:34 +0200 Subject: [PATCH] add test case for non-circular subdivision of polygons --- skimage/measure/tests/test_polygon.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/skimage/measure/tests/test_polygon.py b/skimage/measure/tests/test_polygon.py index 4644fa84..f361bbdc 100644 --- a/skimage/measure/tests/test_polygon.py +++ b/skimage/measure/tests/test_polygon.py @@ -1,6 +1,6 @@ import numpy as np from skimage.measure import approximate_polygon, subdivide_polygon - +from skimage.measure._polygon import _SUBDIVISION_MASKS square = np.array([ [0, 0], [0, 1], [0, 2], [0, 3], @@ -26,9 +26,14 @@ def test_approximate_polygon(): def test_subdivide_polygon(): for degree in range(1, 7): + # test circular out = subdivide_polygon(square, degree) np.testing.assert_array_equal(out[-1], out[0]) np.testing.assert_equal(out.shape[0], 2 * square.shape[0] - 1) + # test non-circular + out = subdivide_polygon(square[:-1], degree) + mask_len = len(_SUBDIVISION_MASKS[degree][0]) + np.testing.assert_equal(out.shape[0], 2 * (square.shape[0] - mask_len)) if __name__ == "__main__":