Skip to content

Commit

Permalink
Merge pull request #2372 from VisualPaul/fix_error_message_pil
Browse files Browse the repository at this point in the history
Fix display problem when printing error messages
  • Loading branch information
soupault committed Nov 28, 2016
2 parents 25826ea + 3cee24b commit 58473ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion skimage/io/_plugins/pil_plugin.py
Expand Up @@ -250,7 +250,7 @@ def imsave(fname, arr, format_str=None, **kwargs):
arr = arr.astype(np.uint8)

if arr.ndim not in (2, 3):
raise ValueError("Invalid shape for image array: %s" % arr.shape)
raise ValueError("Invalid shape for image array: %s" % (arr.shape, ))

if arr.ndim == 3:
if arr.shape[2] not in (3, 4):
Expand Down
4 changes: 4 additions & 0 deletions skimage/io/tests/test_pil.py
Expand Up @@ -184,6 +184,10 @@ def test_imsave_roundtrip_file(self):
def test_imsave_roundtrip_pil_image(self):
self.verify_imsave_roundtrip(self.roundtrip_pil_image)

def test_imsave_incorrect_dimension():
with temporary_file(suffix='.png') as fname:
assert_raises(ValueError, imsave, fname, np.zeros((2, 3, 3, 1)))
assert_raises(ValueError, imsave, fname, np.zeros((2, 3, 2)))

def test_imsave_filelike():
shape = (2, 2)
Expand Down

0 comments on commit 58473ce

Please sign in to comment.