Skip to content

Commit 0fc9b91

Browse files
authored
Merge pull request #7835 from Yay295/patch-1
Parametrize test_p_from_rgb_rgba()
2 parents 274924e + e678557 commit 0fc9b91

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

Tests/test_image.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -685,15 +685,18 @@ def _make_new(
685685
_make_new(im, blank_p, ImagePalette.ImagePalette())
686686
_make_new(im, blank_pa, ImagePalette.ImagePalette())
687687

688-
def test_p_from_rgb_rgba(self) -> None:
689-
for mode, color in [
688+
@pytest.mark.parametrize(
689+
"mode, color",
690+
(
690691
("RGB", "#DDEEFF"),
691692
("RGB", (221, 238, 255)),
692693
("RGBA", (221, 238, 255, 255)),
693-
]:
694-
im = Image.new("P", (100, 100), color)
695-
expected = Image.new(mode, (100, 100), color)
696-
assert_image_equal(im.convert(mode), expected)
694+
),
695+
)
696+
def test_p_from_rgb_rgba(self, mode: str, color: str | tuple[int, ...]) -> None:
697+
im = Image.new("P", (100, 100), color)
698+
expected = Image.new(mode, (100, 100), color)
699+
assert_image_equal(im.convert(mode), expected)
697700

698701
def test_no_resource_warning_on_save(self, tmp_path: Path) -> None:
699702
# https://github.com/python-pillow/Pillow/issues/835

0 commit comments

Comments
 (0)