Skip to content

Commit 7516805

Browse files
committed
Improved DDS test coverage
1 parent d80cf0e commit 7516805

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed
132 Bytes
Binary file not shown.

Tests/test_file_dds.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,21 +380,28 @@ def test_palette() -> None:
380380
assert_image_equal_tofile(im, "Tests/images/transparent.gif")
381381

382382

383+
def test_unsupported_header_size() -> None:
384+
with pytest.raises(OSError, match="Unsupported header size 0"):
385+
with Image.open(BytesIO(b"DDS " + b"\x00" * 4)):
386+
pass
387+
388+
383389
def test_unsupported_bitcount() -> None:
384-
with pytest.raises(OSError):
390+
with pytest.raises(OSError, match="Unsupported bitcount 24 for 131072"):
385391
with Image.open("Tests/images/unsupported_bitcount.dds"):
386392
pass
387393

388394

389395
@pytest.mark.parametrize(
390-
"test_file",
396+
"test_file, message",
391397
(
392-
"Tests/images/unimplemented_dxgi_format.dds",
393-
"Tests/images/unimplemented_pfflags.dds",
398+
("Tests/images/unimplemented_dxgi_format.dds", "Unimplemented DXGI format 93"),
399+
("Tests/images/unimplemented_pixel_format.dds", "Unimplemented pixel format 0"),
400+
("Tests/images/unimplemented_pfflags.dds", "Unknown pixel format flags 8"),
394401
),
395402
)
396-
def test_not_implemented(test_file: str) -> None:
397-
with pytest.raises(NotImplementedError):
403+
def test_not_implemented(test_file: str, message: str) -> None:
404+
with pytest.raises(NotImplementedError, match=message):
398405
with Image.open(test_file):
399406
pass
400407

0 commit comments

Comments
 (0)