From 8794c463181b94dc39cab8bd368efe809cc9adde Mon Sep 17 00:00:00 2001 From: hugovk Date: Sat, 26 Apr 2014 20:05:02 +0300 Subject: [PATCH] For pickling, test with Image's __eq__. Everything else can use the old assert_image_equal. --- Tests/test_pickle.py | 4 ++-- Tests/tester.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Tests/test_pickle.py b/Tests/test_pickle.py index 7da385624..ac8e0545d 100644 --- a/Tests/test_pickle.py +++ b/Tests/test_pickle.py @@ -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(): diff --git a/Tests/tester.py b/Tests/tester.py index a58872e2c..c1e8404d7 100644 --- a/Tests/tester.py +++ b/Tests/tester.py @@ -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()