Test negative intensities

This commit is contained in:
Johannes Schönberger
2014-06-18 10:57:34 -04:00
parent 57b9e67b31
commit 21c80d2567
+9 -1
View File
@@ -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()