Skip to content

Commit

Permalink
Combine tests through parametrization
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Apr 19, 2024
1 parent 533f78e commit 11ac0c1
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions Tests/test_imagesequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,18 @@ def test_iterator_min_frame() -> None:
assert i[index] == next(i)


def _test_multipage_tiff() -> None:
@pytest.mark.parametrize(
"libtiff", (pytest.param(True, marks=skip_unless_feature("libtiff")), False)
)
def test_multipage_tiff(monkeypatch: pytest.MonkeyPatch, libtiff: bool) -> None:
monkeypatch.setattr(TiffImagePlugin, "READ_LIBTIFF", libtiff)
with Image.open("Tests/images/multipage.tiff") as im:
for index, frame in enumerate(ImageSequence.Iterator(im)):
frame.load()
assert index == im.tell()
frame.convert("RGB")


def test_tiff() -> None:
_test_multipage_tiff()


@skip_unless_feature("libtiff")
def test_libtiff(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(TiffImagePlugin, "READ_LIBTIFF", True)
_test_multipage_tiff()


def test_consecutive() -> None:
with Image.open("Tests/images/multipage.tiff") as im:
first_frame = None
Expand Down

0 comments on commit 11ac0c1

Please sign in to comment.