Added roundtrip test for ImagePalette.save

This commit is contained in:
wiredfool 2014-06-24 09:58:53 -07:00
parent 8755bda4e3
commit 5b4d5148af

View File

@ -26,15 +26,15 @@ class TestImagePalette(PillowTestCase):
def test_file(self):
palette = ImagePalette()
palette = ImagePalette("RGB", list(range(256))*3)
file = self.tempfile("temp.lut")
f = self.tempfile("temp.lut")
palette.save(file)
palette.save(f)
from PIL.ImagePalette import load, raw
p = load(file)
p = load(f)
# load returns raw palette information
self.assertEqual(len(p[0]), 768)
@ -42,7 +42,7 @@ class TestImagePalette(PillowTestCase):
p = raw(p[1], p[0])
self.assertIsInstance(p, ImagePalette)
self.assertEqual(p.palette, palette.tobytes())
if __name__ == '__main__':
unittest.main()