mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-11 00:50:51 +03:00
36 lines
745 B
Python
36 lines
745 B
Python
|
from helper import unittest, PillowTestCase, lena
|
||
|
|
||
|
from PIL import Image
|
||
|
|
||
|
|
||
|
class TestImage(PillowTestCase):
|
||
|
|
||
|
def test_sanity(self):
|
||
|
im = lena()
|
||
|
|
||
|
im = im.quantize()
|
||
|
self.assert_image(im, "P", im.size)
|
||
|
|
||
|
im = lena()
|
||
|
im = im.quantize(palette=lena("P"))
|
||
|
self.assert_image(im, "P", im.size)
|
||
|
|
||
|
def test_octree_quantize(self):
|
||
|
im = lena()
|
||
|
|
||
|
im = im.quantize(100, Image.FASTOCTREE)
|
||
|
self.assert_image(im, "P", im.size)
|
||
|
|
||
|
assert len(im.getcolors()) == 100
|
||
|
|
||
|
def test_rgba_quantize(self):
|
||
|
im = lena('RGBA')
|
||
|
im.quantize()
|
||
|
self.assertRaises(Exception, lambda: im.quantize(method=0))
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
unittest.main()
|
||
|
|
||
|
# End of file
|