Skip to content

Commit

Permalink
Merge pull request #7835 from Yay295/patch-1
Browse files Browse the repository at this point in the history
Parametrize test_p_from_rgb_rgba()
  • Loading branch information
radarhere committed Feb 26, 2024
2 parents 274924e + e678557 commit 0fc9b91
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,15 +685,18 @@ def _make_new(
_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)),
]:
im = Image.new("P", (100, 100), color)
expected = Image.new(mode, (100, 100), color)
assert_image_equal(im.convert(mode), expected)
),
)
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)

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

0 comments on commit 0fc9b91

Please sign in to comment.