Skip to content

Commit

Permalink
Merge pull request #1 from radarhere/test_cleanup
Browse files Browse the repository at this point in the history
Only compare bytes once
  • Loading branch information
Yay295 authored Dec 31, 2022
2 parents e91a284 + 85288ce commit 0dc6a56
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,18 @@ def assert_image(im, mode, size, msg=None):
def assert_image_equal(a, b, msg=None):
assert a.mode == b.mode, msg or f"got mode {repr(a.mode)}, expected {repr(b.mode)}"
assert a.size == b.size, msg or f"got size {repr(a.size)}, expected {repr(b.size)}"
if a.tobytes() != b.tobytes():

try:
assert a.tobytes() == b.tobytes(), msg or "got different content"
except AssertionError:
if HAS_UPLOADER:
try:
url = test_image_results.upload(a, b)
logger.error(f"Url for test images: {url}")
except Exception:
pass

assert a.tobytes() == b.tobytes(), msg or "got different content"
raise


def assert_image_equal_tofile(a, filename, msg=None, mode=None):
Expand Down

0 comments on commit 0dc6a56

Please sign in to comment.