2014-09-05 14:03:56 +04:00
|
|
|
from helper import unittest, PillowTestCase, hopper
|
2012-10-16 00:26:38 +04:00
|
|
|
|
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
class TestImageGetPalette(PillowTestCase):
|
|
|
|
|
|
|
|
def test_palette(self):
|
|
|
|
def palette(mode):
|
2014-09-05 14:03:56 +04:00
|
|
|
p = hopper(mode).getpalette()
|
2014-06-10 13:10:47 +04:00
|
|
|
if p:
|
|
|
|
return p[:10]
|
|
|
|
return None
|
|
|
|
self.assertEqual(palette("1"), None)
|
|
|
|
self.assertEqual(palette("L"), None)
|
|
|
|
self.assertEqual(palette("I"), None)
|
|
|
|
self.assertEqual(palette("F"), None)
|
|
|
|
self.assertEqual(palette("P"), [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
|
|
|
|
self.assertEqual(palette("RGB"), None)
|
|
|
|
self.assertEqual(palette("RGBA"), None)
|
|
|
|
self.assertEqual(palette("CMYK"), None)
|
|
|
|
self.assertEqual(palette("YCbCr"), None)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|
|
|
|
|
|
|
|
# End of file
|