auto-formatting

This commit is contained in:
Yay295 2022-08-22 13:34:47 -05:00
parent 05f78ca4db
commit 6aa7a7edd0

View File

@ -531,39 +531,45 @@ class TestImage:
px = im.load() px = im.load()
assert px[0, 0] == 5 assert px[0, 0] == 5
@pytest.mark.parametrize("wrong_mode", [ @pytest.mark.parametrize(
"bad", "wrong_mode",
"I;16N", [
# "LAB", "bad",
"BGR;15", "I;16N",
"BGR;16", # "LAB",
"BGR;24", "BGR;15",
"BGR;32", "BGR;16",
]) "BGR;24",
"BGR;32",
],
)
def test_linear_gradient_wrong_mode(self, wrong_mode): def test_linear_gradient_wrong_mode(self, wrong_mode):
with pytest.raises(ValueError): with pytest.raises(ValueError):
Image.linear_gradient(wrong_mode) Image.linear_gradient(wrong_mode)
@pytest.mark.parametrize("mode,pixel_a,pixel_b", [ @pytest.mark.parametrize(
("1", 0, 255), "mode,pixel_a,pixel_b",
("P", 0, 255), [
("PA", (0, 255), (255, 255)), ("1", 0, 255),
("L", 0, 255), ("P", 0, 255),
("LA", (0, 255), (255, 255)), ("PA", (0, 255), (255, 255)),
("La", (0, 255), (255, 255)), ("L", 0, 255),
("F", 0, 255), ("LA", (0, 255), (255, 255)),
("I", 0, 255), ("La", (0, 255), (255, 255)),
("I;16", 0, 255), ("F", 0, 255),
("I;16L", 0, 255), ("I", 0, 255),
("I;16B", 0, 255), ("I;16", 0, 255),
("RGB", (0, 0, 0), (255, 255, 255)), ("I;16L", 0, 255),
("RGBX", (0, 0, 0, 255), (255, 255, 255, 255)), ("I;16B", 0, 255),
("RGBA", (0, 0, 0, 255), (255, 255, 255, 255)), ("RGB", (0, 0, 0), (255, 255, 255)),
("RGBa", (0, 0, 0, 255), (255, 255, 255, 255)), ("RGBX", (0, 0, 0, 255), (255, 255, 255, 255)),
("CMYK", (0, 0, 0, 255), (0, 0, 0, 0)), ("RGBA", (0, 0, 0, 255), (255, 255, 255, 255)),
("YCbCr", (0, 128, 128), (255, 128, 128)), ("RGBa", (0, 0, 0, 255), (255, 255, 255, 255)),
("HSV", (0, 0, 0), (0, 0, 255)), ("CMYK", (0, 0, 0, 255), (0, 0, 0, 0)),
]) ("YCbCr", (0, 128, 128), (255, 128, 128)),
("HSV", (0, 0, 0), (0, 0, 255)),
],
)
def test_linear_gradient(self, mode, pixel_a, pixel_b): def test_linear_gradient(self, mode, pixel_a, pixel_b):
# Arrange # Arrange
target_file = "Tests/images/linear_gradient.png" target_file = "Tests/images/linear_gradient.png"
@ -580,39 +586,45 @@ class TestImage:
target = target.convert(mode, dither=0) target = target.convert(mode, dither=0)
assert_image_equal(im, target) assert_image_equal(im, target)
@pytest.mark.parametrize("wrong_mode", [ @pytest.mark.parametrize(
"bad", "wrong_mode",
"I;16N", [
# "LAB", "bad",
"BGR;15", "I;16N",
"BGR;16", # "LAB",
"BGR;24", "BGR;15",
"BGR;32", "BGR;16",
]) "BGR;24",
"BGR;32",
],
)
def test_radial_gradient_wrong_mode(self, wrong_mode): def test_radial_gradient_wrong_mode(self, wrong_mode):
with pytest.raises(ValueError): with pytest.raises(ValueError):
Image.radial_gradient(wrong_mode) Image.radial_gradient(wrong_mode)
@pytest.mark.parametrize("mode,pixel_a,pixel_b", [ @pytest.mark.parametrize(
("1", 255, 0), "mode,pixel_a,pixel_b",
("P", 255, 0), [
("PA", (255, 255), (0, 255)), ("1", 255, 0),
("L", 255, 0), ("P", 255, 0),
("LA", (255, 255), (0, 255)), ("PA", (255, 255), (0, 255)),
("La", (255, 255), (0, 255)), ("L", 255, 0),
("F", 255, 0), ("LA", (255, 255), (0, 255)),
("I", 255, 0), ("La", (255, 255), (0, 255)),
("I;16", 255, 0), ("F", 255, 0),
("I;16L", 255, 0), ("I", 255, 0),
("I;16B", 255, 0), ("I;16", 255, 0),
("RGB", (255, 255, 255), (0, 0, 0)), ("I;16L", 255, 0),
("RGBX", (255, 255, 255, 255), (0, 0, 0, 255)), ("I;16B", 255, 0),
("RGBA", (255, 255, 255, 255), (0, 0, 0, 255)), ("RGB", (255, 255, 255), (0, 0, 0)),
("RGBa", (255, 255, 255, 255), (0, 0, 0, 255)), ("RGBX", (255, 255, 255, 255), (0, 0, 0, 255)),
("CMYK", (0, 0, 0, 0), (0, 0, 0, 255)), ("RGBA", (255, 255, 255, 255), (0, 0, 0, 255)),
("YCbCr", (255, 128, 128), (0, 128, 128)), ("RGBa", (255, 255, 255, 255), (0, 0, 0, 255)),
("HSV", (0, 0, 255), (0, 0, 0)), ("CMYK", (0, 0, 0, 0), (0, 0, 0, 255)),
]) ("YCbCr", (255, 128, 128), (0, 128, 128)),
("HSV", (0, 0, 255), (0, 0, 0)),
],
)
def test_radial_gradient(self, mode, pixel_a, pixel_b): def test_radial_gradient(self, mode, pixel_a, pixel_b):
# Arrange # Arrange
target_file = "Tests/images/radial_gradient.png" target_file = "Tests/images/radial_gradient.png"