mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-17 11:42:25 +03:00
Test unknown colour and missing colour key
This commit is contained in:
parent
34efaaddf3
commit
dce9608961
|
@ -33,6 +33,17 @@ def test_rgb() -> None:
|
||||||
assert_image_similar(im, hopper(), 16)
|
assert_image_similar(im, hopper(), 16)
|
||||||
|
|
||||||
|
|
||||||
|
def test_cannot_read() -> None:
|
||||||
|
with open(TEST_FILE, "rb") as fp:
|
||||||
|
data = fp.read().split(b"#")[0]
|
||||||
|
with pytest.raises(ValueError, match="cannot read this XPM file"):
|
||||||
|
with Image.open(BytesIO(data)) as im:
|
||||||
|
pass
|
||||||
|
with pytest.raises(ValueError, match="cannot read this XPM file"):
|
||||||
|
with Image.open(BytesIO(data+b"invalid")) as im:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def test_not_enough_image_data() -> None:
|
def test_not_enough_image_data() -> None:
|
||||||
with open(TEST_FILE, "rb") as fp:
|
with open(TEST_FILE, "rb") as fp:
|
||||||
data = fp.read().split(b"/* pixels */")[0]
|
data = fp.read().split(b"/* pixels */")[0]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user