From e4b49239c4151a4ed0d190eb0a57f6f555285ef6 Mon Sep 17 00:00:00 2001 From: cgohlke Date: Tue, 22 May 2012 00:25:42 -0700 Subject: [PATCH] Adjust tests for new type conversion rules --- skimage/util/tests/test_dtype.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/skimage/util/tests/test_dtype.py b/skimage/util/tests/test_dtype.py index d5067981..e42030b0 100644 --- a/skimage/util/tests/test_dtype.py +++ b/skimage/util/tests/test_dtype.py @@ -9,8 +9,8 @@ dtype_range = {np.uint8: (0, 255), np.uint16: (0, 65535), np.int8: (-128, 127), np.int16: (-32768, 32767), - np.float32: (0, 1), - np.float64: (0, 1)} + np.float32: (-1.0, 1.0), + np.float64: (-1.0, 1.0)} def _verify_range(msg, x, vmin, vmax): assert_equal(x[0], vmin) @@ -29,8 +29,9 @@ def test_range(): omin, omax = dtype_range[dt] - if imin == 0: + if imin == 0 or omin == 0: omin = 0 + imin = 0 yield _verify_range, \ "From %s to %s" % (np.dtype(dtype), np.dtype(dt)), \ @@ -67,13 +68,6 @@ def test_unsupported_dtype(): assert_raises(ValueError, img_as_int, x) -def test_float_out_of_range(): - too_high = np.array([2], dtype=np.float32) - assert_raises(ValueError, img_as_int, too_high) - too_low = np.array([-1], dtype=np.float32) - assert_raises(ValueError, img_as_int, too_low) - - def test_copy(): x = np.array([1], dtype=np.float64) y = img_as_float(x) @@ -84,4 +78,3 @@ def test_copy(): if __name__ == '__main__': np.testing.run_module_suite() -