mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
Parametrized test
This commit is contained in:
parent
eab2b17d64
commit
8f5762ec5f
|
@ -49,14 +49,18 @@ def test_getcolor():
|
|||
palette.getcolor("unknown")
|
||||
|
||||
|
||||
def test_getcolor_not_special():
|
||||
im = Image.new("P", (1, 1))
|
||||
for index, palette in {
|
||||
@pytest.mark.parametrize(
|
||||
"index, palette",
|
||||
[
|
||||
# Test when the palette is not full
|
||||
0: ImagePalette.ImagePalette(),
|
||||
(0, ImagePalette.ImagePalette()),
|
||||
# Test when the palette is full
|
||||
255: ImagePalette.ImagePalette("RGB", list(range(256)) * 3),
|
||||
}.items():
|
||||
(255, ImagePalette.ImagePalette("RGB", list(range(256)) * 3)),
|
||||
],
|
||||
)
|
||||
def test_getcolor_not_special(index, palette):
|
||||
im = Image.new("P", (1, 1))
|
||||
|
||||
# Do not use transparency index as a new color
|
||||
im.info["transparency"] = index
|
||||
index1 = palette.getcolor((0, 0, 0), im)
|
||||
|
|
Loading…
Reference in New Issue
Block a user