Skip to content

Commit e946c7b

Browse files
authored
Test using _seek to skip frames (python-pillow#8804)
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
1 parent 5ba72a9 commit e946c7b

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Tests/test_file_apng.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ def test_apng_basic() -> None:
3434
with pytest.raises(EOFError):
3535
im.seek(2)
3636

37-
# test rewind support
3837
im.seek(0)
38+
with pytest.raises(ValueError, match="cannot seek to frame 2"):
39+
im._seek(2)
40+
41+
# test rewind support
3942
assert im.getpixel((0, 0)) == (255, 0, 0, 255)
4043
assert im.getpixel((64, 32)) == (255, 0, 0, 255)
4144
im.seek(1)

Tests/test_file_fli.py

+3
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ def test_seek() -> None:
160160

161161
assert_image_equal_tofile(im, "Tests/images/a_fli.png")
162162

163+
with pytest.raises(ValueError, match="cannot seek to frame 52"):
164+
im._seek(52)
165+
163166

164167
@pytest.mark.parametrize(
165168
"test_file",

Tests/test_file_gif.py

+4
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,10 @@ def test_seek() -> None:
410410
except EOFError:
411411
assert frame_count == 5
412412

413+
img.seek(0)
414+
with pytest.raises(ValueError, match="cannot seek to frame 2"):
415+
img._seek(2)
416+
413417

414418
def test_seek_info() -> None:
415419
with Image.open("Tests/images/iss634.gif") as im:

0 commit comments

Comments
 (0)