Skip to content

Commit

Permalink
Corrected test
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Oct 10, 2022
1 parent f9a3178 commit 982d7c4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Tests/test_image_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,14 @@ def test_reference_counting(self):

@pytest.mark.parametrize("mode", ("P", "PA"))
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))
access = PyAccess.new(im, False)
access.putpixel((0, 0), color)

alpha = color[3] if len(color) == 4 and mode == "PA" else 255
assert im.convert("RGBA").getpixel((0, 0)) == (255, 0, 0, alpha)
if len(color) == 3:
color += (255,)
assert im.convert("RGBA").getpixel((0, 0)) == color


class TestImagePutPixelError(AccessTest):
Expand Down

0 comments on commit 982d7c4

Please sign in to comment.