improve error message

This commit is contained in:
homm 2016-12-02 15:42:33 +03:00
parent 98042cd4b7
commit cf25722a73

View File

@ -307,9 +307,9 @@ class CoreResampleAlphaCorrectTest(PillowTestCase):
class CoreResamplePassesTest(PillowTestCase):
@contextmanager
def count(self, diff):
count = Image.core.getcount() + diff
count = Image.core.getcount()
yield
self.assertEqual(Image.core.getcount(), count)
self.assertEqual(Image.core.getcount() - count, diff)
def test_horizontal(self):
im = hopper('L')
@ -332,6 +332,7 @@ class CoreResamplePassesTest(PillowTestCase):
with self.count(1):
# the same size, but different box
with_box = im.resize(im.size, Image.BILINEAR, box)
with self.count(2):
cropped = im.crop(box).resize(im.size, Image.BILINEAR)
self.assert_image_similar(with_box, cropped, 0.1)
@ -341,6 +342,7 @@ class CoreResamplePassesTest(PillowTestCase):
with self.count(1):
# the same size, but different box
with_box = im.resize(im.size, Image.BILINEAR, box)
with self.count(2):
cropped = im.crop(box).resize(im.size, Image.BILINEAR)
self.assert_image_similar(with_box, cropped, 0.1)