mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 17:06:16 +03:00
Use more specific assertions
This commit is contained in:
parent
901c1e2aea
commit
d1ca4916e0
|
@ -187,10 +187,10 @@ class PillowTestCase(unittest.TestCase):
|
|||
return result
|
||||
|
||||
def assert_all_same(self, items, msg=None):
|
||||
self.assertTrue(items.count(items[0]) == len(items), msg)
|
||||
self.assertEqual(items.count(items[0]), len(items), msg)
|
||||
|
||||
def assert_not_all_same(self, items, msg=None):
|
||||
self.assertFalse(items.count(items[0]) == len(items), msg)
|
||||
self.assertNotEqual(items.count(items[0]), len(items), msg)
|
||||
|
||||
def assert_tuple_approx_equal(self, actuals, targets, threshold, msg):
|
||||
"""Tests if actuals has values within threshold from targets"""
|
||||
|
|
|
@ -545,11 +545,11 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
def test_read_icc(self):
|
||||
with Image.open("Tests/images/hopper.iccprofile.tif") as img:
|
||||
icc = img.info.get('icc_profile')
|
||||
self.assertNotEqual(icc, None)
|
||||
self.assertIsNotNone(icc)
|
||||
TiffImagePlugin.READ_LIBTIFF = True
|
||||
with Image.open("Tests/images/hopper.iccprofile.tif") as img:
|
||||
icc_libtiff = img.info.get('icc_profile')
|
||||
self.assertNotEqual(icc_libtiff, None)
|
||||
self.assertIsNotNone(icc_libtiff)
|
||||
TiffImagePlugin.READ_LIBTIFF = False
|
||||
self.assertEqual(icc, icc_libtiff)
|
||||
|
||||
|
|
|
@ -516,7 +516,7 @@ class TestImage(PillowTestCase):
|
|||
self.assertEqual(new_im.palette.tobytes(),
|
||||
palette_result.tobytes())
|
||||
else:
|
||||
self.assertEqual(new_im.palette, None)
|
||||
self.assertIsNone(new_im.palette)
|
||||
|
||||
_make_new(im, im_p, im_p.palette)
|
||||
_make_new(im_p, im, None)
|
||||
|
|
|
@ -88,7 +88,7 @@ class TestImageConvert(PillowTestCase):
|
|||
# Assert
|
||||
self.assertNotIn('transparency', im_rgba.info)
|
||||
# https://github.com/python-pillow/Pillow/issues/2702
|
||||
self.assertEqual(im_rgba.palette, None)
|
||||
self.assertIsNone(im_rgba.palette)
|
||||
|
||||
def test_trns_l(self):
|
||||
im = hopper('L')
|
||||
|
|
Loading…
Reference in New Issue
Block a user