Merge pull request #7835 from Yay295/patch-1

Parametrize test_p_from_rgb_rgba()
This commit is contained in:
Andrew Murray 2024-02-27 07:39:17 +11:00 committed by GitHub
commit 0fc9b9183f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -685,12 +685,15 @@ class TestImage:
_make_new(im, blank_p, ImagePalette.ImagePalette())
_make_new(im, blank_pa, ImagePalette.ImagePalette())
def test_p_from_rgb_rgba(self) -> None:
for mode, color in [
@pytest.mark.parametrize(
"mode, color",
(
("RGB", "#DDEEFF"),
("RGB", (221, 238, 255)),
("RGBA", (221, 238, 255, 255)),
]:
),
)
def test_p_from_rgb_rgba(self, mode: str, color: str | tuple[int, ...]) -> None:
im = Image.new("P", (100, 100), color)
expected = Image.new(mode, (100, 100), color)
assert_image_equal(im.convert(mode), expected)