mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Corrected test
This commit is contained in:
parent
f9a3178bb3
commit
982d7c49e3
|
@ -345,13 +345,14 @@ class TestCffi(AccessTest):
|
||||||
|
|
||||||
@pytest.mark.parametrize("mode", ("P", "PA"))
|
@pytest.mark.parametrize("mode", ("P", "PA"))
|
||||||
def test_p_putpixel_rgb_rgba(self, mode):
|
def test_p_putpixel_rgb_rgba(self, mode):
|
||||||
for color in [(255, 0, 0), (255, 0, 0, 127)]:
|
for color in ((255, 0, 0), (255, 0, 0, 127 if mode == "PA" else 255)):
|
||||||
im = Image.new(mode, (1, 1))
|
im = Image.new(mode, (1, 1))
|
||||||
access = PyAccess.new(im, False)
|
access = PyAccess.new(im, False)
|
||||||
access.putpixel((0, 0), color)
|
access.putpixel((0, 0), color)
|
||||||
|
|
||||||
alpha = color[3] if len(color) == 4 and mode == "PA" else 255
|
if len(color) == 3:
|
||||||
assert im.convert("RGBA").getpixel((0, 0)) == (255, 0, 0, alpha)
|
color += (255,)
|
||||||
|
assert im.convert("RGBA").getpixel((0, 0)) == color
|
||||||
|
|
||||||
|
|
||||||
class TestImagePutPixelError(AccessTest):
|
class TestImagePutPixelError(AccessTest):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user