Skip to content

Commit

Permalink
Merge pull request #8626 from radarhere/monkeypatch
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Dec 27, 2024
2 parents f9767fb + 89f1498 commit 4db5be1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Tests/test_image_thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,20 @@ def test_transposed() -> None:
assert im.size == (590, 88)


def test_load_first_unless_jpeg() -> None:
def test_load_first_unless_jpeg(monkeypatch: pytest.MonkeyPatch) -> None:
# Test that thumbnail() still uses draft() for JPEG
with Image.open("Tests/images/hopper.jpg") as im:
draft = im.draft
original_draft = im.draft

def im_draft(
mode: str, size: tuple[int, int]
mode: str | None, size: tuple[int, int] | None
) -> tuple[str, tuple[int, int, float, float]] | None:
result = draft(mode, size)
result = original_draft(mode, size)
assert result is not None

return result

im.draft = im_draft
monkeypatch.setattr(im, "draft", im_draft)

im.thumbnail((64, 64))

Expand Down

0 comments on commit 4db5be1

Please sign in to comment.