10
10
11
11
import pytest
12
12
13
- from PIL import Image
13
+ from PIL import Image , ImageFile
14
14
15
15
from .helper import (
16
16
assert_image_equal ,
@@ -179,7 +179,7 @@ def test_cross_platform(self, tmp_path: Path) -> None:
179
179
180
180
181
181
@pytest .fixture
182
- def gradients_image () -> Generator [Image . Image , None , None ]:
182
+ def gradients_image () -> Generator [ImageFile . ImageFile , None , None ]:
183
183
with Image .open ("Tests/images/radial_gradients.png" ) as im :
184
184
im .load ()
185
185
try :
@@ -189,7 +189,7 @@ def gradients_image() -> Generator[Image.Image, None, None]:
189
189
190
190
191
191
class TestReducingGapResize :
192
- def test_reducing_gap_values (self , gradients_image : Image . Image ) -> None :
192
+ def test_reducing_gap_values (self , gradients_image : ImageFile . ImageFile ) -> None :
193
193
ref = gradients_image .resize (
194
194
(52 , 34 ), Image .Resampling .BICUBIC , reducing_gap = None
195
195
)
@@ -210,7 +210,7 @@ def test_reducing_gap_values(self, gradients_image: Image.Image) -> None:
210
210
)
211
211
def test_reducing_gap_1 (
212
212
self ,
213
- gradients_image : Image . Image ,
213
+ gradients_image : ImageFile . ImageFile ,
214
214
box : tuple [float , float , float , float ],
215
215
epsilon : float ,
216
216
) -> None :
@@ -230,7 +230,7 @@ def test_reducing_gap_1(
230
230
)
231
231
def test_reducing_gap_2 (
232
232
self ,
233
- gradients_image : Image . Image ,
233
+ gradients_image : ImageFile . ImageFile ,
234
234
box : tuple [float , float , float , float ],
235
235
epsilon : float ,
236
236
) -> None :
@@ -250,7 +250,7 @@ def test_reducing_gap_2(
250
250
)
251
251
def test_reducing_gap_3 (
252
252
self ,
253
- gradients_image : Image . Image ,
253
+ gradients_image : ImageFile . ImageFile ,
254
254
box : tuple [float , float , float , float ],
255
255
epsilon : float ,
256
256
) -> None :
@@ -266,7 +266,9 @@ def test_reducing_gap_3(
266
266
267
267
@pytest .mark .parametrize ("box" , (None , (1.1 , 2.2 , 510.8 , 510.9 ), (3 , 10 , 410 , 256 )))
268
268
def test_reducing_gap_8 (
269
- self , gradients_image : Image .Image , box : tuple [float , float , float , float ]
269
+ self ,
270
+ gradients_image : ImageFile .ImageFile ,
271
+ box : tuple [float , float , float , float ],
270
272
) -> None :
271
273
ref = gradients_image .resize ((52 , 34 ), Image .Resampling .BICUBIC , box = box )
272
274
im = gradients_image .resize (
@@ -281,7 +283,7 @@ def test_reducing_gap_8(
281
283
)
282
284
def test_box_filter (
283
285
self ,
284
- gradients_image : Image . Image ,
286
+ gradients_image : ImageFile . ImageFile ,
285
287
box : tuple [float , float , float , float ],
286
288
epsilon : float ,
287
289
) -> None :
0 commit comments