Skip to content

Commit cfca02a

Browse files
committed
Improved WAL test coverage
1 parent e0da1a6 commit cfca02a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Tests/test_file_wal.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
from io import BytesIO
4+
35
from PIL import WalImageFile
46

57
from .helper import assert_image_equal_tofile
@@ -13,12 +15,22 @@ def test_open() -> None:
1315
assert im.format_description == "Quake2 Texture"
1416
assert im.mode == "P"
1517
assert im.size == (128, 128)
18+
assert "next_name" not in im.info
1619

1720
assert isinstance(im, WalImageFile.WalImageFile)
1821

1922
assert_image_equal_tofile(im, "Tests/images/hopper_wal.png")
2023

2124

25+
def test_next_name() -> None:
26+
with open(TEST_FILE, "rb") as fp:
27+
data = bytearray(fp.read())
28+
data[56:60] = b"Test"
29+
f = BytesIO(data)
30+
with WalImageFile.open(f) as im:
31+
assert im.info["next_name"] == b"Test"
32+
33+
2234
def test_load() -> None:
2335
with WalImageFile.open(TEST_FILE) as im:
2436
px = im.load()

0 commit comments

Comments
 (0)