~ubuntu-branches/ubuntu/wily/python-imaging/wily

« back to all changes in this revision

Viewing changes to Tests/test_imagefileio.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-01-31 20:49:20 UTC
  • mfrom: (27.1.1 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20130131204920-b5zshy6vgfvdionl
Tags: 1.1.7+1.7.8-1ubuntu1
Rewrite build dependencies to allow cross builds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from tester import *
 
2
 
 
3
from PIL import Image
 
4
from PIL import ImageFileIO
 
5
 
 
6
def test_fileio():
 
7
 
 
8
    class DumbFile:
 
9
        def __init__(self, data):
 
10
            self.data = data
 
11
        def read(self, bytes=None):
 
12
            assert_equal(bytes, None)
 
13
            return self.data
 
14
        def close(self):
 
15
            pass
 
16
 
 
17
    im1 = lena()
 
18
 
 
19
    io = ImageFileIO.ImageFileIO(DumbFile(tostring(im1, "PPM")))
 
20
 
 
21
    im2 = Image.open(io)
 
22
    assert_image_equal(im1, im2)
 
23
 
 
24