From a6f4419da4d2db4e82b31833d63eabefd439b398 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 12 Dec 2015 14:20:38 -0600 Subject: [PATCH] Update failing tests --- skimage/io/tests/test_mpl_imshow.py | 3 +-- skimage/util/tests/test_dtype.py | 11 +++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/skimage/io/tests/test_mpl_imshow.py b/skimage/io/tests/test_mpl_imshow.py index 9b814f57..e369273a 100644 --- a/skimage/io/tests/test_mpl_imshow.py +++ b/skimage/io/tests/test_mpl_imshow.py @@ -87,8 +87,7 @@ def test_outside_standard_range(): def test_nonstandard_type(): plt.figure() - with expected_warnings(["Non-standard image type", - "Low image dynamic range"]): + with expected_warnings(["Low image dynamic range"]): ax_im = io.imshow(im64) assert ax_im.get_clim() == (im64.min(), im64.max()) assert n_subplots(ax_im) == 2 diff --git a/skimage/util/tests/test_dtype.py b/skimage/util/tests/test_dtype.py index 612c43e6..85f1ac9a 100644 --- a/skimage/util/tests/test_dtype.py +++ b/skimage/util/tests/test_dtype.py @@ -29,7 +29,7 @@ def test_range(): (img_as_float, np.float64), (img_as_uint, np.uint16), (img_as_ubyte, np.ubyte)]: - + with expected_warnings(['precision loss|sign loss|\A\Z']): y = f(x) @@ -62,7 +62,7 @@ def test_range_extra_dtypes(): for dtype_in, dt in dtype_pairs: imin, imax = dtype_range_extra[dtype_in] x = np.linspace(imin, imax, 10).astype(dtype_in) - + with expected_warnings(['precision loss|sign loss|\A\Z']): y = convert(x, dt) @@ -72,9 +72,12 @@ def test_range_extra_dtypes(): y, omin, omax, np.dtype(dt)) -def test_unsupported_dtype(): +def test_downcast(): x = np.arange(10).astype(np.uint64) - assert_raises(ValueError, img_as_int, x) + with expected_warnings('Downcasting'): + y = img_as_int(x) + assert np.allclose(y, x.astype(np.int16)) + assert y.dtype == np.uint16 def test_float_out_of_range():