diff --git a/Tests/images/FudanPed00003_mask.png b/Tests/images/FudanPed00003_mask.png new file mode 100644 index 000000000..b58d856e9 Binary files /dev/null and b/Tests/images/FudanPed00003_mask.png differ diff --git a/Tests/test_file_png.py b/Tests/test_file_png.py index c4db97905..720d2de21 100644 --- a/Tests/test_file_png.py +++ b/Tests/test_file_png.py @@ -100,6 +100,27 @@ class TestFilePng: reloaded = reloaded.convert(mode) assert_image_equal(reloaded, im) + def test_putpalette(self): + valid_file = "Tests/images/FudanPed00003_mask.png" + with pytest.raises(ValueError): + mask = Image.open(valid_file) + mask.putpalette( + [ + 0, + 0, + 0, # black background + 255, + 0, + 0, # index 1 is red + 255, + 255, + 0, # index 2 is yellow + 255, + 153, + 0, # index 3 is orange + ] + ) + def test_invalid_file(self): invalid_file = "Tests/images/flower.jpg"