From b304a13bca506f04b18b1cc44074d3ce14896dad Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 22 Sep 2020 13:06:52 +1000 Subject: [PATCH] Updated test --- Tests/test_image_access.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Tests/test_image_access.py b/Tests/test_image_access.py index 5ec312046..e86dc8530 100644 --- a/Tests/test_image_access.py +++ b/Tests/test_image_access.py @@ -328,17 +328,27 @@ class TestCffi(AccessTest): class TestImagePutPixelError(AccessTest): - IMAGE_MODES = ["L", "LA", "RGB", "RGBA", "I", "I;16", "BGR;15"] + IMAGE_MODES1 = ["L", "LA", "RGB", "RGBA"] + IMAGE_MODES2 = ["I", "I;16", "BGR;15"] INVALID_TYPES = ["foo", 1.0, None] - @pytest.mark.parametrize("mode", IMAGE_MODES) - def test_putpixel_type_error(self, mode): + @pytest.mark.parametrize("mode", IMAGE_MODES1) + def test_putpixel_type_error1(self, mode): im = hopper(mode) for v in self.INVALID_TYPES: with pytest.raises(TypeError, match="color must be int or tuple"): im.putpixel((0, 0), v) - @pytest.mark.parametrize("mode", IMAGE_MODES) + @pytest.mark.parametrize("mode", IMAGE_MODES2) + def test_putpixel_type_error2(self, mode): + im = hopper(mode) + for v in self.INVALID_TYPES: + with pytest.raises( + TypeError, match="color must be int or single-element tuple" + ): + im.putpixel((0, 0), v) + + @pytest.mark.parametrize("mode", IMAGE_MODES1 + IMAGE_MODES2) def test_putpixel_overflow_error(self, mode): im = hopper(mode) with pytest.raises(OverflowError):