@@ -388,21 +388,18 @@ def test_autocontrast_preserve_gradient():
388
388
assert_image_equal (img , out )
389
389
390
390
391
- def test_autocontrast_preserve_onecolor ():
392
- def _test_one_color (color ):
393
- img = Image .new ("RGB" , (10 , 10 ), color )
394
-
395
- # single color images shouldn't change
396
- out = ImageOps .autocontrast (img , cutoff = 0 , preserve_tone = True )
397
- assert_image_equal (img , out ) # single color, no cutoff
398
-
399
- # even if there is a cutoff
400
- out = ImageOps .autocontrast (
401
- img , cutoff = 0 , preserve_tone = True
402
- ) # single color 10 cutoff
403
- assert_image_equal (img , out )
404
-
405
- _test_one_color ((255 , 255 , 255 ))
406
- _test_one_color ((127 , 255 , 0 ))
407
- _test_one_color ((127 , 127 , 127 ))
408
- _test_one_color ((0 , 0 , 0 ))
391
+ @pytest .mark .parametrize (
392
+ "color" , ((255 , 255 , 255 ), (127 , 255 , 0 ), (127 , 127 , 127 ), (0 , 0 , 0 ))
393
+ )
394
+ def test_autocontrast_preserve_one_color (color ):
395
+ img = Image .new ("RGB" , (10 , 10 ), color )
396
+
397
+ # single color images shouldn't change
398
+ out = ImageOps .autocontrast (img , cutoff = 0 , preserve_tone = True )
399
+ assert_image_equal (img , out ) # single color, no cutoff
400
+
401
+ # even if there is a cutoff
402
+ out = ImageOps .autocontrast (
403
+ img , cutoff = 0 , preserve_tone = True
404
+ ) # single color 10 cutoff
405
+ assert_image_equal (img , out )
0 commit comments