Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test using _seek to skip frames #8804

Merged
merged 1 commit into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Tests/test_file_apng.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions Tests/test_file_fli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions Tests/test_file_gif.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading