Test invalid input for seed

This commit is contained in:
Johannes Schönberger
2014-05-10 09:07:01 -04:00
parent 837406c8fc
commit 69a0255a28
@@ -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()