diff --git a/Tests/test_file_png.py b/Tests/test_file_png.py index 32dc10cd1..e4d495330 100644 --- a/Tests/test_file_png.py +++ b/Tests/test_file_png.py @@ -347,7 +347,8 @@ class TestFilePng(PillowTestCase): im2 = Image.open(f) self.assertIn('transparency', im2.info) - self.assert_image_equal(im2.convert('RGBA'), im.convert('RGBA')) + self.assert_image_similar(im2.convert('RGBA'), im.convert('RGBA'), + 16) def test_save_icc_profile_none(self): # check saving files with an ICC profile set to None (omit profile) diff --git a/Tests/test_image_getcolors.py b/Tests/test_image_getcolors.py index f3586565a..8886762c7 100644 --- a/Tests/test_image_getcolors.py +++ b/Tests/test_image_getcolors.py @@ -16,25 +16,25 @@ class TestImageGetColors(PillowTestCase): return None self.assertEqual(getcolors("1"), 2) - self.assertEqual(getcolors("L"), 193) - self.assertEqual(getcolors("I"), 193) - self.assertEqual(getcolors("F"), 193) - self.assertEqual(getcolors("P"), 54) # fixed palette + self.assertEqual(getcolors("L"), 255) + self.assertEqual(getcolors("I"), 255) + self.assertEqual(getcolors("F"), 255) + self.assertEqual(getcolors("P"), 90) # fixed palette self.assertEqual(getcolors("RGB"), None) self.assertEqual(getcolors("RGBA"), None) self.assertEqual(getcolors("CMYK"), None) self.assertEqual(getcolors("YCbCr"), None) self.assertEqual(getcolors("L", 128), None) - self.assertEqual(getcolors("L", 1024), 193) + self.assertEqual(getcolors("L", 1024), 255) self.assertEqual(getcolors("RGB", 8192), None) - self.assertEqual(getcolors("RGB", 16384), 14836) - self.assertEqual(getcolors("RGB", 100000), 14836) + self.assertEqual(getcolors("RGB", 16384), 10100) + self.assertEqual(getcolors("RGB", 100000), 10100) - self.assertEqual(getcolors("RGBA", 16384), 14836) - self.assertEqual(getcolors("CMYK", 16384), 14836) - self.assertEqual(getcolors("YCbCr", 16384), 11995) + self.assertEqual(getcolors("RGBA", 16384), 10100) + self.assertEqual(getcolors("CMYK", 16384), 10100) + self.assertEqual(getcolors("YCbCr", 16384), 9329) # -------------------------------------------------------------------- @@ -43,10 +43,9 @@ class TestImageGetColors(PillowTestCase): im = hopper().quantize(3).convert("RGB") - expected = [ - (3236, (227, 183, 147)), - (6297, (143, 84, 81)), - (6851, (208, 143, 112))] + expected = [(4039, (172, 166, 181)), + (4385, (124, 113, 134)), + (7960, (31, 20, 33))] A = im.getcolors(maxcolors=2) self.assertEqual(A, None) diff --git a/Tests/test_image_getdata.py b/Tests/test_image_getdata.py index bc925420d..89bfda895 100644 --- a/Tests/test_image_getdata.py +++ b/Tests/test_image_getdata.py @@ -10,7 +10,7 @@ class TestImageGetData(PillowTestCase): len(data) list(data) - self.assertEqual(data[0], (223, 162, 133)) + self.assertEqual(data[0], (20, 20, 70)) def test_roundtrip(self): @@ -19,14 +19,14 @@ class TestImageGetData(PillowTestCase): data = im.getdata() return data[0], len(data), len(list(data)) - self.assertEqual(getdata("1"), (255, 960, 960)) - self.assertEqual(getdata("L"), (176, 960, 960)) - self.assertEqual(getdata("I"), (176, 960, 960)) - self.assertEqual(getdata("F"), (176.0, 960, 960)) - self.assertEqual(getdata("RGB"), ((223, 162, 133), 960, 960)) - self.assertEqual(getdata("RGBA"), ((223, 162, 133, 255), 960, 960)) - self.assertEqual(getdata("CMYK"), ((32, 93, 122, 0), 960, 960)) - self.assertEqual(getdata("YCbCr"), ((176, 103, 160), 960, 960)) + self.assertEqual(getdata("1"), (0, 960, 960)) + self.assertEqual(getdata("L"), (25, 960, 960)) + self.assertEqual(getdata("I"), (25, 960, 960)) + self.assertEqual(getdata("F"), (25.0, 960, 960)) + self.assertEqual(getdata("RGB"), (((20, 20, 70), 960, 960))) + self.assertEqual(getdata("RGBA"), ((20, 20, 70, 255), 960, 960)) + self.assertEqual(getdata("CMYK"), ((235, 235, 185, 0), 960, 960)) + self.assertEqual(getdata("YCbCr"), ((25, 153, 123), 960, 960)) if __name__ == '__main__': diff --git a/Tests/test_image_getextrema.py b/Tests/test_image_getextrema.py index 066d563c4..84d932a98 100644 --- a/Tests/test_image_getextrema.py +++ b/Tests/test_image_getextrema.py @@ -9,16 +9,16 @@ class TestImageGetExtrema(PillowTestCase): return hopper(mode).getextrema() self.assertEqual(extrema("1"), (0, 255)) - self.assertEqual(extrema("L"), (40, 235)) - self.assertEqual(extrema("I"), (40, 235)) - self.assertEqual(extrema("F"), (40.0, 235.0)) - self.assertEqual(extrema("P"), (11, 218)) # fixed palette + self.assertEqual(extrema("L"), (0, 255)) + self.assertEqual(extrema("I"), (0, 255)) + self.assertEqual(extrema("F"), (0, 255)) + self.assertEqual(extrema("P"), (0, 225)) # fixed palette self.assertEqual( - extrema("RGB"), ((61, 255), (26, 234), (44, 223))) + extrema("RGB"), ((0, 255), (0, 255), (0, 255))) self.assertEqual( - extrema("RGBA"), ((61, 255), (26, 234), (44, 223), (255, 255))) + extrema("RGBA"), ((0, 255), (0, 255), (0, 255), (255, 255))) self.assertEqual( - extrema("CMYK"), ((0, 194), (21, 229), (32, 211), (0, 0))) + extrema("CMYK"), (((0, 255), (0, 255), (0, 255), (0, 0)))) if __name__ == '__main__': diff --git a/Tests/test_image_histogram.py b/Tests/test_image_histogram.py index 4bf8d2f80..aa849a138 100644 --- a/Tests/test_image_histogram.py +++ b/Tests/test_image_histogram.py @@ -9,15 +9,15 @@ class TestImageHistogram(PillowTestCase): h = hopper(mode).histogram() return len(h), min(h), max(h) - self.assertEqual(histogram("1"), (256, 0, 8872)) - self.assertEqual(histogram("L"), (256, 0, 199)) - self.assertEqual(histogram("I"), (256, 0, 199)) - self.assertEqual(histogram("F"), (256, 0, 199)) - self.assertEqual(histogram("P"), (256, 0, 2912)) - self.assertEqual(histogram("RGB"), (768, 0, 285)) + self.assertEqual(histogram("1"), (256, 0, 10994)) + self.assertEqual(histogram("L"), (256, 0, 638)) + self.assertEqual(histogram("I"), (256, 0, 638)) + self.assertEqual(histogram("F"), (256, 0, 638)) + self.assertEqual(histogram("P"), (256, 0, 1871)) + self.assertEqual(histogram("RGB"), (768, 4, 675)) self.assertEqual(histogram("RGBA"), (1024, 0, 16384)) self.assertEqual(histogram("CMYK"), (1024, 0, 16384)) - self.assertEqual(histogram("YCbCr"), (768, 0, 741)) + self.assertEqual(histogram("YCbCr"), (768, 0, 1908)) if __name__ == '__main__': diff --git a/Tests/test_imagestat.py b/Tests/test_imagestat.py index fbb96599a..4d5e42b3f 100644 --- a/Tests/test_imagestat.py +++ b/Tests/test_imagestat.py @@ -35,11 +35,11 @@ class TestImageStat(PillowTestCase): st = ImageStat.Stat(im) # verify a few values - self.assertEqual(st.extrema[0], (61, 255)) - self.assertEqual(st.median[0], 197) - self.assertEqual(st.sum[0], 2954416) - self.assertEqual(st.sum[1], 2027250) - self.assertEqual(st.sum[2], 1727331) + self.assertEqual(st.extrema[0], (0, 255)) + self.assertEqual(st.median[0], 72) + self.assertEqual(st.sum[0], 1470218) + self.assertEqual(st.sum[1], 1311896) + self.assertEqual(st.sum[2], 1563008) def test_constant(self):