From 1740767a3a89ec46b1613e3230e54790832c96f4 Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Mon, 25 Jan 2016 13:56:45 +0530 Subject: [PATCH] Add test for threshold_otsu on single color image --- skimage/filters/tests/test_thresholding.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/skimage/filters/tests/test_thresholding.py b/skimage/filters/tests/test_thresholding.py index 16682610..4c14b8b6 100644 --- a/skimage/filters/tests/test_thresholding.py +++ b/skimage/filters/tests/test_thresholding.py @@ -1,5 +1,7 @@ import numpy as np -from numpy.testing import assert_equal, assert_almost_equal +from numpy.testing import (assert_equal, + assert_almost_equal, + assert_raises) import skimage from skimage import data @@ -162,6 +164,11 @@ def test_otsu_astro_image(): with expected_warnings(['grayscale']): assert 109 < threshold_otsu(img) < 111 + +def test_otsu_one_color_image(): + img = np.ones((10, 10), dtype=np.uint8) + assert_raises(TypeError, threshold_otsu, img) + def test_li_camera_image(): camera = skimage.img_as_ubyte(data.camera()) assert 63 < threshold_li(camera) < 65