diff --git a/Tests/helper.py b/Tests/helper.py index 8fb34848b..030335745 100644 --- a/Tests/helper.py +++ b/Tests/helper.py @@ -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""" diff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py index ddd39ba8c..5b0b0c46b 100644 --- a/Tests/test_file_libtiff.py +++ b/Tests/test_file_libtiff.py @@ -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) diff --git a/Tests/test_image.py b/Tests/test_image.py index ad56a079a..715c588da 100644 --- a/Tests/test_image.py +++ b/Tests/test_image.py @@ -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) diff --git a/Tests/test_image_convert.py b/Tests/test_image_convert.py index 1b3815d80..e57ae4305 100644 --- a/Tests/test_image_convert.py +++ b/Tests/test_image_convert.py @@ -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')