Test type warning from remove_small_objects

This commit is contained in:
Juan Nunez-Iglesias
2014-09-30 15:04:28 +10:00
parent a2def31fca
commit 8711c74533
+9 -1
View File
@@ -1,5 +1,6 @@
import numpy as np
from numpy.testing import assert_array_equal, assert_equal, assert_raises
from numpy.testing import (assert_array_equal, assert_equal, assert_raises,
assert_warns)
from skimage.morphology import remove_small_objects
test_image = np.array([[0, 0, 0, 1, 0],
@@ -55,6 +56,13 @@ def test_uint_image():
assert_array_equal(observed, expected)
def test_single_label_warning():
image = np.array([[0, 0, 0, 1, 0],
[1, 1, 1, 0, 0],
[1, 1, 1, 0, 0]], int)
assert_warns(UserWarning, remove_small_objects, image, min_size=6)
def test_float_input():
float_test = np.random.rand(5, 5)
assert_raises(TypeError, remove_small_objects, float_test)