MCPcopy
hub / github.com/python-pillow/Pillow / assert_image_equal

Function assert_image_equal

Tests/helper.py:87–98  ·  view source on GitHub ↗
(a: Image.Image, b: Image.Image, msg: str | None = None)

Source from the content-addressed store, hash-verified

85
86
87def assert_image_equal(a: Image.Image, b: Image.Image, msg: str | None = None) -> None:
88 assert a.mode == b.mode, msg or f"got mode {repr(a.mode)}, expected {repr(b.mode)}"
89 assert a.size == b.size, msg or f"got size {repr(a.size)}, expected {repr(b.size)}"
90 if a.tobytes() != b.tobytes():
91 try:
92 url = upload(a, b)
93 if url:
94 logger.error("URL for test images: %s", url)
95 except Exception:
96 pass
97
98 pytest.fail(msg or "got different content")
99
100
101def assert_image_equal_tofile(

Callers 15

test_angleFunction · 0.85
test_fastpath_centerFunction · 0.85
test_fastpath_translateFunction · 0.85
test_openFunction · 0.85
test_sanityFunction · 0.85
test_strategyFunction · 0.85
test_palette_434Function · 0.85
test_save_netpbm_l_modeFunction · 0.85
test_seek_rewindFunction · 0.85

Calls 2

uploadFunction · 0.85
tobytesMethod · 0.45

Tested by 15

test_angleFunction · 0.68
test_fastpath_centerFunction · 0.68
test_fastpath_translateFunction · 0.68
test_openFunction · 0.68
test_sanityFunction · 0.68
test_strategyFunction · 0.68
test_palette_434Function · 0.68
test_save_netpbm_l_modeFunction · 0.68
test_seek_rewindFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…