From fdf0737fcd601942c6f7b8d5ced559796cce7636 Mon Sep 17 00:00:00 2001 From: hugovk Date: Sun, 29 Jan 2017 15:55:17 +0200 Subject: [PATCH] Test matrix convert for ValueError: image has wrong mode --- Tests/test_image_convert.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Tests/test_image_convert.py b/Tests/test_image_convert.py index 170b174ad..512a86491 100644 --- a/Tests/test_image_convert.py +++ b/Tests/test_image_convert.py @@ -150,6 +150,19 @@ class TestImageConvert(PillowTestCase): self.assertRaises(ValueError, lambda: im.convert(mode='CMYK', matrix=matrix)) + def test_matrix_wrong_mode(self): + # Arrange + im = hopper('L') + matrix = ( + 0.412453, 0.357580, 0.180423, 0, + 0.212671, 0.715160, 0.072169, 0, + 0.019334, 0.119193, 0.950227, 0) + self.assertEqual(im.mode, 'L') + + # Act / Assert + self.assertRaises(ValueError, + lambda: im.convert(mode='L', matrix=matrix)) + def test_matrix_rgb(self): def matrix_convert(mode):