mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-11 07:44:46 +03:00
Enrich tests for putpalette function
This commit is contained in:
parent
117618b01f
commit
376c4f829f
BIN
Tests/images/FudanPed00003_mask.png
Normal file
BIN
Tests/images/FudanPed00003_mask.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -100,6 +100,18 @@ class TestFilePng:
|
||||||
reloaded = reloaded.convert(mode)
|
reloaded = reloaded.convert(mode)
|
||||||
assert_image_equal(reloaded, im)
|
assert_image_equal(reloaded, im)
|
||||||
|
|
||||||
|
def test_putpalette(self):
|
||||||
|
valid_file = "Tests/images/FudanPed00003_mask.png"
|
||||||
|
with pytest.raises(ValueError) as err:
|
||||||
|
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):
|
def test_invalid_file(self):
|
||||||
invalid_file = "Tests/images/flower.jpg"
|
invalid_file = "Tests/images/flower.jpg"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user