Pillow/Tests/test_image_getpalette.py

25 lines
719 B
Python
Raw Normal View History

from helper import unittest, PillowTestCase, hopper
2014-06-10 13:10:47 +04:00
class TestImageGetPalette(PillowTestCase):
def test_palette(self):
def palette(mode):
p = hopper(mode).getpalette()
2014-06-10 13:10:47 +04:00
if p:
return p[:10]
return None
self.assertIsNone(palette("1"))
self.assertIsNone(palette("L"))
self.assertIsNone(palette("I"))
self.assertIsNone(palette("F"))
2014-06-10 13:10:47 +04:00
self.assertEqual(palette("P"), [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
self.assertIsNone(palette("RGB"))
self.assertIsNone(palette("RGBA"))
self.assertIsNone(palette("CMYK"))
self.assertIsNone(palette("YCbCr"))
2014-06-10 13:10:47 +04:00
if __name__ == '__main__':
unittest.main()