Test using _seek to skip frames

This commit is contained in:
Andrew Murray 2025-03-06 19:36:36 +11:00
parent 5ba72a9b54
commit 7ea171f0e1
3 changed files with 11 additions and 1 deletions

View File

@ -34,8 +34,11 @@ def test_apng_basic() -> None:
with pytest.raises(EOFError):
im.seek(2)
# test rewind support
im.seek(0)
with pytest.raises(ValueError, match="cannot seek to frame 2"):
im._seek(2)
# test rewind support
assert im.getpixel((0, 0)) == (255, 0, 0, 255)
assert im.getpixel((64, 32)) == (255, 0, 0, 255)
im.seek(1)

View File

@ -160,6 +160,9 @@ def test_seek() -> None:
assert_image_equal_tofile(im, "Tests/images/a_fli.png")
with pytest.raises(ValueError, match="cannot seek to frame 52"):
im._seek(52)
@pytest.mark.parametrize(
"test_file",

View File

@ -410,6 +410,10 @@ def test_seek() -> None:
except EOFError:
assert frame_count == 5
img.seek(0)
with pytest.raises(ValueError, match="cannot seek to frame 2"):
img._seek(2)
def test_seek_info() -> None:
with Image.open("Tests/images/iss634.gif") as im: