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 TestImageGetExtrema(PillowTestCase):
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
def test_extrema(self):
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
def extrema(mode):
|
2014-09-05 14:03:56 +04:00
|
|
|
return hopper(mode).getextrema()
|
2014-06-10 13:10:47 +04:00
|
|
|
|
|
|
|
self.assertEqual(extrema("1"), (0, 255))
|
2014-09-14 21:00:13 +04:00
|
|
|
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
|
2014-06-10 13:10:47 +04:00
|
|
|
self.assertEqual(
|
2014-09-14 21:00:13 +04:00
|
|
|
extrema("RGB"), ((0, 255), (0, 255), (0, 255)))
|
2014-06-10 13:10:47 +04:00
|
|
|
self.assertEqual(
|
2014-09-14 21:00:13 +04:00
|
|
|
extrema("RGBA"), ((0, 255), (0, 255), (0, 255), (255, 255)))
|
2014-06-10 13:10:47 +04:00
|
|
|
self.assertEqual(
|
2014-09-14 21:00:13 +04:00
|
|
|
extrema("CMYK"), (((0, 255), (0, 255), (0, 255), (0, 0))))
|
2014-06-10 13:10:47 +04:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|
|
|
|
|
|
|
|
# End of file
|