Skip to content

Commit 09a7255

Browse files
Yay295hugovk
andauthored
Apply suggestions from code review
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 2fd3cb5 commit 09a7255

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

Tests/test_image_filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test_modefilter(mode, expected):
7474

7575

7676
@pytest.mark.parametrize(
77-
"mode,expected",
77+
"mode, expected",
7878
(
7979
("1", (0, 4, 8)),
8080
("L", (0, 4, 8)),

Tests/test_image_reduce.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040

4141
@pytest.mark.parametrize(
42-
"size,expected",
42+
"size, expected",
4343
(
4444
(3, (4, 4)),
4545
((3, 1), (4, 10)),
@@ -52,16 +52,16 @@ def test_args_factor(size, expected):
5252

5353

5454
@pytest.mark.parametrize(
55-
"size,error", ((0, ValueError), (2.0, TypeError), ((0, 10), ValueError))
55+
"size, expected_error", ((0, ValueError), (2.0, TypeError), ((0, 10), ValueError))
5656
)
57-
def test_args_factor_error(size, error):
57+
def test_args_factor_error(size, expected_error):
5858
im = Image.new("L", (10, 10))
59-
with pytest.raises(error):
59+
with pytest.raises(expected_error):
6060
im.reduce(size)
6161

6262

6363
@pytest.mark.parametrize(
64-
"size,expected",
64+
"size, expected",
6565
(
6666
((0, 0, 10, 10), (5, 5)),
6767
((5, 5, 6, 6), (1, 1)),
@@ -73,7 +73,7 @@ def test_args_box(size, expected):
7373

7474

7575
@pytest.mark.parametrize(
76-
"size,error",
76+
"size, expected_error",
7777
(
7878
("stri", TypeError),
7979
((0, 0, 11, 10), ValueError),
@@ -84,9 +84,9 @@ def test_args_box(size, expected):
8484
((5, 0, 5, 10), ValueError),
8585
),
8686
)
87-
def test_args_box_error(size, error):
87+
def test_args_box_error(size, expected_error):
8888
im = Image.new("L", (10, 10))
89-
with pytest.raises(error):
89+
with pytest.raises(expected_error):
9090
im.reduce(2, size).size
9191

9292

Tests/test_image_transform.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ def test_quad(self):
7676
assert_image_equal(transformed, scaled)
7777

7878
@pytest.mark.parametrize(
79-
"mode,pixel",
79+
"mode, expected_pixel",
8080
(
8181
("RGB", (255, 0, 0)),
8282
("RGBA", (255, 0, 0, 255)),
8383
("LA", (76, 0)),
8484
),
8585
)
86-
def test_fill(self, mode, pixel):
86+
def test_fill(self, mode, expected_pixel):
8787
im = hopper(mode)
8888
(w, h) = im.size
8989
transformed = im.transform(
@@ -93,7 +93,7 @@ def test_fill(self, mode, pixel):
9393
Image.Resampling.BILINEAR,
9494
fillcolor="red",
9595
)
96-
assert transformed.getpixel((w - 1, h - 1)) == pixel
96+
assert transformed.getpixel((w - 1, h - 1)) == expected_pixel
9797

9898
def test_mesh(self):
9999
# this should be a checkerboard of halfsized hoppers in ul, lr
@@ -240,7 +240,7 @@ def _test_image(self):
240240
return im.crop((10, 20, im.width - 10, im.height - 20))
241241

242242
@pytest.mark.parametrize(
243-
"deg,transpose",
243+
"deg, transpose",
244244
(
245245
(0, None),
246246
(90, Image.Transpose.ROTATE_90),
@@ -281,7 +281,7 @@ def test_rotate(self, deg, transpose):
281281
assert_image_equal(transposed, transformed)
282282

283283
@pytest.mark.parametrize(
284-
"scale,epsilonscale",
284+
"scale, epsilon_scale",
285285
(
286286
(1.1, 6.9),
287287
(1.5, 5.5),
@@ -298,7 +298,7 @@ def test_rotate(self, deg, transpose):
298298
(Image.Resampling.BICUBIC, 1),
299299
),
300300
)
301-
def test_resize(self, scale, epsilonscale, resample, epsilon):
301+
def test_resize(self, scale, epsilon_scale, resample, epsilon):
302302
im = self._test_image()
303303

304304
size_up = int(round(im.width * scale)), int(round(im.height * scale))
@@ -309,25 +309,25 @@ def test_resize(self, scale, epsilonscale, resample, epsilon):
309309
transformed = transformed.transform(
310310
im.size, self.transform, matrix_down, resample
311311
)
312-
assert_image_similar(transformed, im, epsilon * epsilonscale)
312+
assert_image_similar(transformed, im, epsilon * epsilon_scale)
313313

314314
@pytest.mark.parametrize(
315-
"x,y,epsilonscale",
315+
"x, y, epsilon_scale",
316316
(
317317
(0.1, 0, 3.7),
318318
(0.6, 0, 9.1),
319319
(50, 50, 0),
320320
),
321321
)
322322
@pytest.mark.parametrize(
323-
"resample,epsilon",
323+
"resample, epsilon",
324324
(
325325
(Image.Resampling.NEAREST, 0),
326326
(Image.Resampling.BILINEAR, 1.5),
327327
(Image.Resampling.BICUBIC, 1),
328328
),
329329
)
330-
def test_translate(self, x, y, epsilonscale, resample, epsilon):
330+
def test_translate(self, x, y, epsilon_scale, resample, epsilon):
331331
im = self._test_image()
332332

333333
size_up = int(round(im.width + x)), int(round(im.height + y))
@@ -338,7 +338,7 @@ def test_translate(self, x, y, epsilonscale, resample, epsilon):
338338
transformed = transformed.transform(
339339
im.size, self.transform, matrix_down, resample
340340
)
341-
assert_image_similar(transformed, im, epsilon * epsilonscale)
341+
assert_image_similar(transformed, im, epsilon * epsilon_scale)
342342

343343

344344
class TestImageTransformPerspective(TestImageTransformAffine):

0 commit comments

Comments
 (0)