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

Updated test type hint #8482

Merged
merged 1 commit into from
Oct 18, 2024
Merged
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
18 changes: 10 additions & 8 deletions Tests/test_image_resize.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import pytest

from PIL import Image
from PIL import Image, ImageFile

from .helper import (
assert_image_equal,
Expand Down Expand Up @@ -179,7 +179,7 @@ def test_cross_platform(self, tmp_path: Path) -> None:


@pytest.fixture
def gradients_image() -> Generator[Image.Image, None, None]:
def gradients_image() -> Generator[ImageFile.ImageFile, None, None]:
with Image.open("Tests/images/radial_gradients.png") as im:
im.load()
try:
Expand All @@ -189,7 +189,7 @@ def gradients_image() -> Generator[Image.Image, None, None]:


class TestReducingGapResize:
def test_reducing_gap_values(self, gradients_image: Image.Image) -> None:
def test_reducing_gap_values(self, gradients_image: ImageFile.ImageFile) -> None:
ref = gradients_image.resize(
(52, 34), Image.Resampling.BICUBIC, reducing_gap=None
)
Expand All @@ -210,7 +210,7 @@ def test_reducing_gap_values(self, gradients_image: Image.Image) -> None:
)
def test_reducing_gap_1(
self,
gradients_image: Image.Image,
gradients_image: ImageFile.ImageFile,
box: tuple[float, float, float, float],
epsilon: float,
) -> None:
Expand All @@ -230,7 +230,7 @@ def test_reducing_gap_1(
)
def test_reducing_gap_2(
self,
gradients_image: Image.Image,
gradients_image: ImageFile.ImageFile,
box: tuple[float, float, float, float],
epsilon: float,
) -> None:
Expand All @@ -250,7 +250,7 @@ def test_reducing_gap_2(
)
def test_reducing_gap_3(
self,
gradients_image: Image.Image,
gradients_image: ImageFile.ImageFile,
box: tuple[float, float, float, float],
epsilon: float,
) -> None:
Expand All @@ -266,7 +266,9 @@ def test_reducing_gap_3(

@pytest.mark.parametrize("box", (None, (1.1, 2.2, 510.8, 510.9), (3, 10, 410, 256)))
def test_reducing_gap_8(
self, gradients_image: Image.Image, box: tuple[float, float, float, float]
self,
gradients_image: ImageFile.ImageFile,
box: tuple[float, float, float, float],
) -> None:
ref = gradients_image.resize((52, 34), Image.Resampling.BICUBIC, box=box)
im = gradients_image.resize(
Expand All @@ -281,7 +283,7 @@ def test_reducing_gap_8(
)
def test_box_filter(
self,
gradients_image: Image.Image,
gradients_image: ImageFile.ImageFile,
box: tuple[float, float, float, float],
epsilon: float,
) -> None:
Expand Down
Loading