Permalink
Browse files

Revert remove_small_objects to raise TypeError

  • Loading branch information...
1 parent d7d87c9 commit b306f9b70fea71d953ee39ed734f38327e7317cc @jni jni committed Mar 10, 2013
Showing with 6 additions and 4 deletions.
  1. +5 −3 skimage/morphology/misc.py
  2. +1 −1 skimage/morphology/tests/test_misc.py
@@ -21,8 +21,10 @@ def remove_small_objects(ar, min_size=64, connectivity=1, in_place=False):
Raises
------
- ValueError
+ TypeError
If the input array is of an invalid type, such as float or string.
+ ValueError
+ If the input array contains negative values.
Returns
-------
@@ -50,9 +52,9 @@ def remove_small_objects(ar, min_size=64, connectivity=1, in_place=False):
>>> d is a
True
"""
- # Should use `issubdtype` below, but there's a bug in numpy 1.7
+ # Should use `issubdtype` for bool below, but there's a bug in numpy 1.7
if not (ar.dtype == bool or np.issubdtype(ar.dtype, int)):
- raise ValueError("Only bool or integer image types are supported. "
+ raise TypeError("Only bool or integer image types are supported. "
"Got %s." % ar.dtype)
if in_place:
@@ -44,7 +44,7 @@ def test_labeled_image():
def test_float_input():
float_test = np.random.rand(5, 5)
- assert_raises(ValueError, remove_small_objects, float_test)
+ assert_raises(TypeError, remove_small_objects, float_test)
def test_negative_input():

0 comments on commit b306f9b

Please sign in to comment.