Return duplicate in lena()

This commit is contained in:
hugovk 2014-06-06 14:04:26 +03:00
parent 40ada60cec
commit e2e361141c
2 changed files with 12 additions and 11 deletions

View File

@ -29,14 +29,14 @@ script:
- python setup.py build_ext --inplace - python setup.py build_ext --inplace
# Don't cover PyPy: it fails intermittently and is x5.8 slower (#640) # Don't cover PyPy: it fails intermittently and is x5.8 slower (#640)
- if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then python selftest.py; fi - if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then time python selftest.py; fi
- if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then nosetests test/; fi - if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then time nosetests test/; fi
- if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then python Tests/run.py; fi - if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then time python Tests/run.py; fi
# Cover the others # Cover the others
- if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then coverage run --append --include=PIL/* selftest.py; fi - if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then time coverage run --append --include=PIL/* selftest.py; fi
- if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then coverage run --append --include=PIL/* -m nose test/; fi - if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then time coverage run --append --include=PIL/* -m nose test/; fi
- if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then python Tests/run.py --coverage; fi - if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then time python Tests/run.py --coverage; fi
after_success: after_success:

View File

@ -169,10 +169,9 @@ def tostring(im, format, **options):
return out.getvalue() return out.getvalue()
def lena(mode="RGB"): # , cache={}): def lena(mode="RGB"), cache={}):
from PIL import Image from PIL import Image
# im = cache.get(mode) im = cache.get(mode)
im = None
if im is None: if im is None:
if mode == "RGB": if mode == "RGB":
im = Image.open("Images/lena.ppm") im = Image.open("Images/lena.ppm")
@ -182,8 +181,10 @@ def lena(mode="RGB"): # , cache={}):
im = lena("I").convert(mode) im = lena("I").convert(mode)
else: else:
im = lena("RGB").convert(mode) im = lena("RGB").convert(mode)
# cache[mode] = im cache[mode] = im
return im import copy
duplicate = copy.copy(im)
return duplicate
# def assert_image_completely_equal(a, b, msg=None): # def assert_image_completely_equal(a, b, msg=None):