Pillow/test/test_imagefileio.py

34 lines
672 B
Python
Raw Normal View History

2014-06-10 04:36:40 +04:00
from test.helper import unittest, PillowTestCase, lena, tostring
from PIL import Image
from PIL import ImageFileIO
class TestImageFileIo(PillowTestCase):
def test_fileio(self):
class DumbFile:
def __init__(self, data):
self.data = data
2014-06-06 16:26:48 +04:00
def read(self, bytes=None):
2014-06-06 16:26:48 +04:00
assert(bytes is None)
return self.data
2014-06-06 16:26:48 +04:00
def close(self):
pass
im1 = lena()
io = ImageFileIO.ImageFileIO(DumbFile(tostring(im1, "PPM")))
im2 = Image.open(io)
self.assert_image_equal(im1, im2)
if __name__ == '__main__':
unittest.main()
# End of file