log expected & actual color in image access tests

This commit is contained in:
Yay295 2023-01-15 19:42:55 -06:00 committed by GitHub
parent 50f5eade47
commit 7ad50d9185
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,15 +139,18 @@ class TestImageGetPixel(AccessTest):
# check putpixel
im = Image.new(mode, (1, 1), None)
im.putpixel((0, 0), c)
d = im.getpixel((0, 0))
assert (
im.getpixel((0, 0)) == c
), f"put/getpixel roundtrip failed for mode {mode}, color {c}"
d == c
), f"put/getpixel roundtrip failed for mode {mode}, expected {c} got {d}"
# check putpixel negative index
im.putpixel((-1, -1), c)
assert (
im.getpixel((-1, -1)) == c
), f"put/getpixel roundtrip negative index failed for mode {mode}, color {c}"
d = im.getpixel((-1, -1))
assert d == c, (
f"put/getpixel roundtrip negative index failed for mode {mode}, "
f"expected {c} got {d}"
)
# Check 0
im = Image.new(mode, (0, 0), None)
@ -166,13 +169,15 @@ class TestImageGetPixel(AccessTest):
# check initial color
im = Image.new(mode, (1, 1), c)
assert (
im.getpixel((0, 0)) == c
), f"initial color failed for mode {mode}, color {c} "
d = im.getpixel((0, 0))
assert d == c, f"initial color failed for mode {mode}, expected {c} got {d}"
# check initial color negative index
assert (
im.getpixel((-1, -1)) == c
), f"initial color failed with negative index for mode {mode}, color {c} "
d = im.getpixel((-1, -1))
assert d == c, (
f"initial color failed with negative index for mode {mode}, "
f"expected {c} got {d}"
)
# Check 0
im = Image.new(mode, (0, 0), c)