Test missing frame size

This commit is contained in:
Andrew Murray 2025-03-08 09:56:00 +11:00
parent e946c7b14a
commit 5575c1d072

View File

@ -1,5 +1,6 @@
from __future__ import annotations
import io
import warnings
import pytest
@ -132,6 +133,15 @@ def test_eoferror() -> None:
im.seek(n_frames - 1)
def test_missing_frame_size() -> None:
with open(animated_test_file, "rb") as fp:
data = fp.read()
data = data[:6188]
with Image.open(io.BytesIO(data)) as im:
with pytest.raises(EOFError, match="missing frame size"):
im.seek(1)
def test_seek_tell() -> None:
with Image.open(animated_test_file) as im:
layer_number = im.tell()