Pillow/Tests/test_image_getextrema.py

28 lines
818 B
Python
Raw Normal View History

2014-07-07 21:03:50 +04:00
from helper import unittest, PillowTestCase, lena
2014-06-10 13:10:47 +04:00
class TestImageGetExtrema(PillowTestCase):
2014-06-10 13:10:47 +04:00
def test_extrema(self):
2014-06-10 13:10:47 +04:00
def extrema(mode):
return lena(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("RGB"), ((61, 255), (26, 234), (44, 223)))
self.assertEqual(
extrema("RGBA"), ((61, 255), (26, 234), (44, 223), (255, 255)))
self.assertEqual(
extrema("CMYK"), ((0, 194), (21, 229), (32, 211), (0, 0)))
if __name__ == '__main__':
unittest.main()
# End of file