mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-18 20:22:36 +03:00
Improve DdsImagePlugin test coverage (#9091)
This commit is contained in:
commit
71d495add8
BIN
Tests/images/unimplemented_pixel_format.dds
Normal file
BIN
Tests/images/unimplemented_pixel_format.dds
Normal file
Binary file not shown.
|
@ -380,21 +380,28 @@ def test_palette() -> None:
|
||||||
assert_image_equal_tofile(im, "Tests/images/transparent.gif")
|
assert_image_equal_tofile(im, "Tests/images/transparent.gif")
|
||||||
|
|
||||||
|
|
||||||
|
def test_unsupported_header_size() -> None:
|
||||||
|
with pytest.raises(OSError, match="Unsupported header size 0"):
|
||||||
|
with Image.open(BytesIO(b"DDS " + b"\x00" * 4)):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def test_unsupported_bitcount() -> None:
|
def test_unsupported_bitcount() -> None:
|
||||||
with pytest.raises(OSError):
|
with pytest.raises(OSError, match="Unsupported bitcount 24 for 131072"):
|
||||||
with Image.open("Tests/images/unsupported_bitcount.dds"):
|
with Image.open("Tests/images/unsupported_bitcount.dds"):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"test_file",
|
"test_file, message",
|
||||||
(
|
(
|
||||||
"Tests/images/unimplemented_dxgi_format.dds",
|
("Tests/images/unimplemented_dxgi_format.dds", "Unimplemented DXGI format 93"),
|
||||||
"Tests/images/unimplemented_pfflags.dds",
|
("Tests/images/unimplemented_pixel_format.dds", "Unimplemented pixel format 0"),
|
||||||
|
("Tests/images/unimplemented_pfflags.dds", "Unknown pixel format flags 8"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_not_implemented(test_file: str) -> None:
|
def test_not_implemented(test_file: str, message: str) -> None:
|
||||||
with pytest.raises(NotImplementedError):
|
with pytest.raises(NotImplementedError, match=message):
|
||||||
with Image.open(test_file):
|
with Image.open(test_file):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user