For pickling, test with Image's __eq__. Everything else can use the old assert_image_equal.

This commit is contained in:
hugovk 2014-04-26 20:05:02 +03:00
parent 2a6f2c5442
commit 8794c46318
2 changed files with 8 additions and 3 deletions

View File

@ -14,7 +14,7 @@ def helper_test_pickle_file(pickle, protocol=0):
loaded_im = pickle.load(f)
# Assert
assert_image_equal(im, loaded_im)
assert_image_completely_equal(im, loaded_im)
def helper_test_pickle_string(pickle, protocol=0, file='Images/lena.jpg'):
@ -25,7 +25,7 @@ def helper_test_pickle_string(pickle, protocol=0, file='Images/lena.jpg'):
loaded_im = pickle.loads(dumped_string)
# Assert
assert_image_equal(im, loaded_im)
assert_image_completely_equal(im, loaded_im)
def test_pickle_image():

View File

@ -242,7 +242,12 @@ def assert_image_equal(a, b, msg=None):
failure(msg or "got size %r, expected %r" % (a.size, b.size))
elif a.tobytes() != b.tobytes():
failure(msg or "got different content")
elif a != b:
else:
success()
def assert_image_completely_equal(a, b, msg=None):
if a != b:
failure(msg or "images different")
else:
success()