From 8711c745333d358b735756d3db7f0648e55936a6 Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Tue, 30 Sep 2014 15:04:28 +1000 Subject: [PATCH] Test type warning from remove_small_objects --- skimage/morphology/tests/test_misc.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/skimage/morphology/tests/test_misc.py b/skimage/morphology/tests/test_misc.py index 94d27f64..8789b22a 100644 --- a/skimage/morphology/tests/test_misc.py +++ b/skimage/morphology/tests/test_misc.py @@ -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)