mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
ad784eb808
This is Christoph Gohlke's test suite from his personal PIL package found at http://www.lfd.uci.edu/~gohlke/pythonlibs/. This is just to bring it in as a separate commit. Future commits will align it with Pillow.
29 lines
845 B
Python
29 lines
845 B
Python
from tester import *
|
|
|
|
from PIL import Image
|
|
|
|
def test_sanity():
|
|
|
|
data = lena().getdata()
|
|
|
|
assert_no_exception(lambda: len(data))
|
|
assert_no_exception(lambda: list(data))
|
|
|
|
assert_equal(data[0], (223, 162, 133))
|
|
|
|
def test_roundtrip():
|
|
|
|
def getdata(mode):
|
|
im = lena(mode).resize((32, 30))
|
|
data = im.getdata()
|
|
return data[0], len(data), len(list(data))
|
|
|
|
assert_equal(getdata("1"), (255, 960, 960))
|
|
assert_equal(getdata("L"), (176, 960, 960))
|
|
assert_equal(getdata("I"), (176, 960, 960))
|
|
assert_equal(getdata("F"), (176.0, 960, 960))
|
|
assert_equal(getdata("RGB"), ((223, 162, 133), 960, 960))
|
|
assert_equal(getdata("RGBA"), ((223, 162, 133, 255), 960, 960))
|
|
assert_equal(getdata("CMYK"), ((32, 93, 122, 0), 960, 960))
|
|
assert_equal(getdata("YCbCr"), ((176, 103, 160), 960, 960))
|