[skimage.io.tests] add truncated jpg imread tests

This commit is contained in:
Kevin Murray
2014-06-30 19:35:35 +10:00
parent 83d0717986
commit 4160a67a42
3 changed files with 15 additions and 0 deletions
+5
View File
@@ -37,6 +37,11 @@ def test_imread_palette():
img = imread(os.path.join(data_dir, 'palette_color.png'))
assert img.ndim == 3
@skipif(not imread_available)
def test_imread_truncated_jpg():
assert_raises((RuntimeError, ValueError),
sio.imread,
os.path.join(si.data_dir, 'truncated.jpg'))
@skipif(not imread_available)
def test_bilevel():
+4
View File
@@ -95,6 +95,10 @@ def test_repr_png():
assert np.all(original_img == round_trip)
@skipif(not PIL_available)
def test_imread_truncated_jpg():
assert_raises((IOError, ValueError), imread,
os.path.join(data_dir, 'truncated.jpg'))
# Big endian images not correctly loaded for PIL < 1.1.7
# Renable test when PIL 1.1.7 is more common.
+6
View File
@@ -51,6 +51,12 @@ def test_bilevel():
np.testing.assert_array_equal(img, expected)
@skipif(not sitk_available)
def test_imread_truncated_jpg():
assert_raises((RuntimeError, ValueError),
sio.imread,
os.path.join(si.data_dir, 'truncated.jpg'))
@skipif(not sitk_available)
def test_imread_uint16():
expected = np.load(os.path.join(data_dir, 'chessboard_GRAY_U8.npy'))