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