From 21c80d25673564e4a16459789701da0ab5c04dad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Wed, 18 Jun 2014 10:57:34 -0400 Subject: [PATCH] Test negative intensities --- skimage/color/tests/test_colorlabel.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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()