From 69a0255a28df3c8c75f0977c2c93d2f6d55a9012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Sat, 10 May 2014 09:07:01 -0400 Subject: [PATCH] Test invalid input for seed --- skimage/morphology/tests/test_reconstruction.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/skimage/morphology/tests/test_reconstruction.py b/skimage/morphology/tests/test_reconstruction.py index 8e40ac67..99ef39aa 100644 --- a/skimage/morphology/tests/test_reconstruction.py +++ b/skimage/morphology/tests/test_reconstruction.py @@ -8,7 +8,8 @@ All rights reserved. Original author: Lee Kamentsky """ import numpy as np -from numpy.testing import assert_array_almost_equal as assert_close +from numpy.testing import (assert_array_almost_equal as assert_close, + assert_raises) from skimage.morphology.greyreconstruct import reconstruction @@ -77,6 +78,15 @@ def test_fill_hole(): assert_close(result, np.array([0, 3, 6, 4, 4, 4, 4, 4, 2, 0])) +def test_invalid_seed(): + seed = np.ones((5, 5)) + mask = np.ones((5, 5)) + assert_raises(ValueError, reconstruction, seed * 2, mask, + method='dilation') + assert_raises(ValueError, reconstruction, seed * 0.5, mask, + method='erosion') + + if __name__ == '__main__': from numpy import testing testing.run_module_suite()