diff --git a/skimage/color/tests/test_colorlabel.py b/skimage/color/tests/test_colorlabel.py index 357a3a74..4daf3a66 100644 --- a/skimage/color/tests/test_colorlabel.py +++ b/skimage/color/tests/test_colorlabel.py @@ -3,8 +3,9 @@ import itertools import numpy as np from numpy import testing from skimage.color.colorlabel import label2rgb +from skimage._shared.utils import all_warnings from numpy.testing import (assert_array_almost_equal as assert_close, - assert_array_equal) + assert_array_equal, assert_warns) def test_shape_mismatch(): @@ -123,6 +124,13 @@ def test_avg(): assert_array_equal(out_bg, expected_out_bg) +def test_negative_intensity(): + with all_warnings(): + labels = np.arange(100).reshape(10, 10) + image = -1 * np.ones((10, 10)) + assert_warns(UserWarning, label2rgb, labels, image) + + if __name__ == '__main__': testing.run_module_suite()