Change some lena() to hopper()

This commit is contained in:
hugovk 2014-09-05 12:36:24 +03:00
parent eb458c7c8f
commit b929873a62
18 changed files with 76 additions and 76 deletions

View File

@ -1,4 +1,4 @@
from helper import * from helper import unittest, PillowTestCase, hopper
# Not running this test by default. No DOS against Travis CI. # Not running this test by default. No DOS against Travis CI.
@ -39,7 +39,7 @@ def timer(func, label, *args):
class BenchCffiAccess(PillowTestCase): class BenchCffiAccess(PillowTestCase):
def test_direct(self): def test_direct(self):
im = lena() im = hopper()
im.load() im.load()
# im = Image.new( "RGB", (2000, 2000), (1, 3, 2)) # im = Image.new( "RGB", (2000, 2000), (1, 3, 2))
caccess = im.im.pixel_access(False) caccess = im.im.pixel_access(False)

View File

@ -6,7 +6,7 @@ import timeit
def bench(mode): def bench(mode):
im = helper.lena(mode) im = helper.hopper(mode)
get = im.im.getpixel get = im.im.getpixel
xy = 50, 50 # position shouldn't really matter xy = 50, 50 # position shouldn't really matter
t0 = timeit.default_timer() t0 = timeit.default_timer()

View File

@ -191,11 +191,11 @@ def hopper(mode="RGB", cache={}):
if mode == "RGB": if mode == "RGB":
im = Image.open("Tests/images/hopper.ppm") im = Image.open("Tests/images/hopper.ppm")
elif mode == "F": elif mode == "F":
im = lena("L").convert(mode) im = hopper("L").convert(mode)
elif mode[:4] == "I;16": elif mode[:4] == "I;16":
im = lena("I").convert(mode) im = hopper("I").convert(mode)
else: else:
im = lena("RGB").convert(mode) im = hopper("RGB").convert(mode)
# cache[mode] = im # cache[mode] = im
return im return im

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, lena from helper import unittest, PillowTestCase, hopper
try: try:
import cffi import cffi
@ -62,16 +62,16 @@ class TestCffi(PillowTestCase):
self.assertEqual(access[(x, y)], caccess[(x, y)]) self.assertEqual(access[(x, y)], caccess[(x, y)])
def test_get_vs_c(self): def test_get_vs_c(self):
rgb = lena('RGB') rgb = hopper('RGB')
rgb.load() rgb.load()
self._test_get_access(rgb) self._test_get_access(rgb)
self._test_get_access(lena('RGBA')) self._test_get_access(hopper('RGBA'))
self._test_get_access(lena('L')) self._test_get_access(hopper('L'))
self._test_get_access(lena('LA')) self._test_get_access(hopper('LA'))
self._test_get_access(lena('1')) self._test_get_access(hopper('1'))
self._test_get_access(lena('P')) self._test_get_access(hopper('P'))
# self._test_get_access(lena('PA')) # PA -- how do I make a PA image? # self._test_get_access(hopper('PA')) # PA -- how do I make a PA image?
self._test_get_access(lena('F')) self._test_get_access(hopper('F'))
im = Image.new('I;16', (10, 10), 40000) im = Image.new('I;16', (10, 10), 40000)
self._test_get_access(im) self._test_get_access(im)
@ -104,16 +104,16 @@ class TestCffi(PillowTestCase):
self.assertEqual(color, caccess[(x, y)]) self.assertEqual(color, caccess[(x, y)])
def test_set_vs_c(self): def test_set_vs_c(self):
rgb = lena('RGB') rgb = hopper('RGB')
rgb.load() rgb.load()
self._test_set_access(rgb, (255, 128, 0)) self._test_set_access(rgb, (255, 128, 0))
self._test_set_access(lena('RGBA'), (255, 192, 128, 0)) self._test_set_access(hopper('RGBA'), (255, 192, 128, 0))
self._test_set_access(lena('L'), 128) self._test_set_access(hopper('L'), 128)
self._test_set_access(lena('LA'), (128, 128)) self._test_set_access(hopper('LA'), (128, 128))
self._test_set_access(lena('1'), 255) self._test_set_access(hopper('1'), 255)
self._test_set_access(lena('P'), 128) self._test_set_access(hopper('P'), 128)
# self._test_set_access(i, (128, 128)) #PA -- undone how to make # self._test_set_access(i, (128, 128)) #PA -- undone how to make
self._test_set_access(lena('F'), 1024.0) self._test_set_access(hopper('F'), 1024.0)
im = Image.new('I;16', (10, 10), 40000) im = Image.new('I;16', (10, 10), 40000)
self._test_set_access(im, 45000) self._test_set_access(im, 45000)

View File

@ -2,7 +2,7 @@ from helper import unittest, PillowTestCase
from PIL import Image from PIL import Image
test_file = "Tests/images/lena.ppm" TEST_FILE = "Tests/images/hopper.ppm"
ORIGINAL_LIMIT = Image.MAX_IMAGE_PIXELS ORIGINAL_LIMIT = Image.MAX_IMAGE_PIXELS
@ -15,7 +15,7 @@ class TestDecompressionBomb(PillowTestCase):
def test_no_warning_small_file(self): def test_no_warning_small_file(self):
# Implicit assert: no warning. # Implicit assert: no warning.
# A warning would cause a failure. # A warning would cause a failure.
Image.open(test_file) Image.open(TEST_FILE)
def test_no_warning_no_limit(self): def test_no_warning_no_limit(self):
# Arrange # Arrange
@ -26,7 +26,7 @@ class TestDecompressionBomb(PillowTestCase):
# Act / Assert # Act / Assert
# Implicit assert: no warning. # Implicit assert: no warning.
# A warning would cause a failure. # A warning would cause a failure.
Image.open(test_file) Image.open(TEST_FILE)
def test_warning(self): def test_warning(self):
# Arrange # Arrange
@ -37,7 +37,7 @@ class TestDecompressionBomb(PillowTestCase):
# Act / Assert # Act / Assert
self.assert_warning( self.assert_warning(
Image.DecompressionBombWarning, Image.DecompressionBombWarning,
lambda: Image.open(test_file)) lambda: Image.open(TEST_FILE))
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, lena from helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image
import io import io
@ -18,16 +18,16 @@ class TestFileBmp(PillowTestCase):
self.assertEqual(reloaded.format, "BMP") self.assertEqual(reloaded.format, "BMP")
def test_sanity(self): def test_sanity(self):
self.roundtrip(lena()) self.roundtrip(hopper())
self.roundtrip(lena("1")) self.roundtrip(hopper("1"))
self.roundtrip(lena("L")) self.roundtrip(hopper("L"))
self.roundtrip(lena("P")) self.roundtrip(hopper("P"))
self.roundtrip(lena("RGB")) self.roundtrip(hopper("RGB"))
def test_save_to_bytes(self): def test_save_to_bytes(self):
output = io.BytesIO() output = io.BytesIO()
im = lena() im = hopper()
im.save(output, "BMP") im.save(output, "BMP")
output.seek(0) output.seek(0)
@ -41,7 +41,7 @@ class TestFileBmp(PillowTestCase):
dpi = (72, 72) dpi = (72, 72)
output = io.BytesIO() output = io.BytesIO()
im = lena() im = hopper()
im.save(output, "BMP", dpi=dpi) im.save(output, "BMP", dpi=dpi)
output.seek(0) output.seek(0)

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, lena from helper import unittest, PillowTestCase, hopper
from PIL import Image, IptcImagePlugin from PIL import Image, IptcImagePlugin
@ -21,7 +21,7 @@ class TestFileIptc(PillowTestCase):
def test_getiptcinfo_jpg_none(self): def test_getiptcinfo_jpg_none(self):
# Arrange # Arrange
im = lena() im = hopper()
# Act # Act
iptc = IptcImagePlugin.getiptcinfo(im) iptc = IptcImagePlugin.getiptcinfo(im)

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, lena from helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image
@ -9,7 +9,7 @@ class TestFileMsp(PillowTestCase):
file = self.tempfile("temp.msp") file = self.tempfile("temp.msp")
lena("1").save(file) hopper("1").save(file)
im = Image.open(file) im = Image.open(file)
im.load() im.load()

View File

@ -1,14 +1,14 @@
from helper import unittest, PillowTestCase, lena, imagemagick_available from helper import unittest, PillowTestCase, hopper, imagemagick_available
import os.path import os.path
class TestFilePalm(PillowTestCase): class TestFilePalm(PillowTestCase):
_roundtrip = imagemagick_available() _roundtrip = imagemagick_available()
def helper_save_as_palm(self, mode): def helper_save_as_palm(self, mode):
# Arrange # Arrange
im = lena(mode) im = hopper(mode)
outfile = self.tempfile("temp_" + mode + ".palm") outfile = self.tempfile("temp_" + mode + ".palm")
# Act # Act
@ -21,14 +21,14 @@ class TestFilePalm(PillowTestCase):
def roundtrip(self, mode): def roundtrip(self, mode):
if not self._roundtrip: if not self._roundtrip:
return return
im = lena(mode) im = hopper(mode)
outfile = self.tempfile("temp.palm") outfile = self.tempfile("temp.palm")
im.save(outfile) im.save(outfile)
converted = self.open_withImagemagick(outfile) converted = self.open_withImagemagick(outfile)
self.assert_image_equal(converted, im) self.assert_image_equal(converted, im)
def test_monochrome(self): def test_monochrome(self):
# Arrange # Arrange
@ -46,7 +46,7 @@ class TestFilePalm(PillowTestCase):
self.helper_save_as_palm(mode) self.helper_save_as_palm(mode)
self.skipKnownBadTest("Palm P image is wrong") self.skipKnownBadTest("Palm P image is wrong")
self.roundtrip(mode) self.roundtrip(mode)
def test_rgb_ioerror(self): def test_rgb_ioerror(self):
# Arrange # Arrange
mode = "RGB" mode = "RGB"

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, lena from helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image
@ -17,7 +17,7 @@ class TestFilePcx(PillowTestCase):
def test_sanity(self): def test_sanity(self):
for mode in ('1', 'L', 'P', 'RGB'): for mode in ('1', 'L', 'P', 'RGB'):
self._roundtrip(lena(mode)) self._roundtrip(hopper(mode))
def test_odd(self): def test_odd(self):
# see issue #523, odd sized images should have a stride that's even. # see issue #523, odd sized images should have a stride that's even.
@ -26,7 +26,7 @@ class TestFilePcx(PillowTestCase):
for mode in ('1', 'L', 'P', 'RGB'): for mode in ('1', 'L', 'P', 'RGB'):
# larger, odd sized images are better here to ensure that # larger, odd sized images are better here to ensure that
# we handle interrupted scan lines properly. # we handle interrupted scan lines properly.
self._roundtrip(lena(mode).resize((511, 511))) self._roundtrip(hopper(mode).resize((511, 511)))
def test_pil184(self): def test_pil184(self):
# Check reading of files where xmin/xmax is not zero. # Check reading of files where xmin/xmax is not zero.

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, lena from helper import unittest, PillowTestCase, hopper
import os.path import os.path
@ -7,7 +7,7 @@ class TestFilePdf(PillowTestCase):
def helper_save_as_pdf(self, mode): def helper_save_as_pdf(self, mode):
# Arrange # Arrange
im = lena(mode) im = hopper(mode)
outfile = self.tempfile("temp_" + mode + ".pdf") outfile = self.tempfile("temp_" + mode + ".pdf")
# Act # Act

View File

@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase
from PIL import Image from PIL import Image
# sample ppm stream # sample ppm stream
file = "Tests/images/lena.ppm" file = "Tests/images/hopper.ppm"
data = open(file, "rb").read() data = open(file, "rb").read()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, lena, py3 from helper import unittest, PillowTestCase, hopper, py3
from PIL import Image, TiffImagePlugin from PIL import Image, TiffImagePlugin
@ -9,7 +9,7 @@ class TestFileTiff(PillowTestCase):
file = self.tempfile("temp.tif") file = self.tempfile("temp.tif")
lena("RGB").save(file) hopper("RGB").save(file)
im = Image.open(file) im = Image.open(file)
im.load() im.load()
@ -17,19 +17,19 @@ class TestFileTiff(PillowTestCase):
self.assertEqual(im.size, (128, 128)) self.assertEqual(im.size, (128, 128))
self.assertEqual(im.format, "TIFF") self.assertEqual(im.format, "TIFF")
lena("1").save(file) hopper("1").save(file)
im = Image.open(file) im = Image.open(file)
lena("L").save(file) hopper("L").save(file)
im = Image.open(file) im = Image.open(file)
lena("P").save(file) hopper("P").save(file)
im = Image.open(file) im = Image.open(file)
lena("RGB").save(file) hopper("RGB").save(file)
im = Image.open(file) im = Image.open(file)
lena("I").save(file) hopper("I").save(file)
im = Image.open(file) im = Image.open(file)
def test_mac_tiff(self): def test_mac_tiff(self):
@ -158,14 +158,14 @@ class TestFileTiff(PillowTestCase):
im.seek(2) im.seek(2)
im.load() im.load()
self.assertEqual(im.size, (20,20)) self.assertEqual(im.size, (20,20))
self.assertEqual(im.convert('RGB').getpixel((0,0)), (0,0,255)) self.assertEqual(im.convert('RGB').getpixel((0,0)), (0,0,255))
def test_multipage_last_frame(self): def test_multipage_last_frame(self):
im = Image.open('Tests/images/multipage-lastframe.tif') im = Image.open('Tests/images/multipage-lastframe.tif')
im.load() im.load()
self.assertEqual(im.size, (20,20)) self.assertEqual(im.size, (20,20))
self.assertEqual(im.convert('RGB').getpixel((0,0)), (0,0,255)) self.assertEqual(im.convert('RGB').getpixel((0,0)), (0,0,255))
def test___str__(self): def test___str__(self):
# Arrange # Arrange

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, lena from helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image
@ -40,7 +40,7 @@ class TestFileWebpAlpha(PillowTestCase):
temp_file = self.tempfile("temp.webp") temp_file = self.tempfile("temp.webp")
# temp_file = "temp.webp" # temp_file = "temp.webp"
pil_image = lena('RGBA') pil_image = hopper('RGBA')
mask = Image.new("RGBA", (64, 64), (128, 128, 128, 128)) mask = Image.new("RGBA", (64, 64), (128, 128, 128, 128))
# Add some partially transparent bits: # Add some partially transparent bits:

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, lena from helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image
@ -23,7 +23,7 @@ class TestFileWebpLossless(PillowTestCase):
def test_write_lossless_rgb(self): def test_write_lossless_rgb(self):
temp_file = self.tempfile("temp.webp") temp_file = self.tempfile("temp.webp")
lena("RGB").save(temp_file, lossless=True) hopper("RGB").save(temp_file, lossless=True)
image = Image.open(temp_file) image = Image.open(temp_file)
image.load() image.load()
@ -34,7 +34,7 @@ class TestFileWebpLossless(PillowTestCase):
image.load() image.load()
image.getdata() image.getdata()
self.assert_image_equal(image, lena("RGB")) self.assert_image_equal(image, hopper("RGB"))
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, lena from helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image
from PIL import ImageChops from PIL import ImageChops
@ -8,7 +8,7 @@ class TestImageChops(PillowTestCase):
def test_sanity(self): def test_sanity(self):
im = lena("L") im = hopper("L")
ImageChops.constant(im, 128) ImageChops.constant(im, 128)
ImageChops.duplicate(im) ImageChops.duplicate(im)

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, lena from helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image
from PIL import ImageColor from PIL import ImageColor
@ -34,7 +34,7 @@ POINTS2 = [10, 10, 20, 40, 30, 30]
class TestImageDraw(PillowTestCase): class TestImageDraw(PillowTestCase):
def test_sanity(self): def test_sanity(self):
im = lena("RGB").copy() im = hopper("RGB").copy()
draw = ImageDraw.ImageDraw(im) draw = ImageDraw.ImageDraw(im)
draw = ImageDraw.Draw(im) draw = ImageDraw.Draw(im)
@ -45,7 +45,7 @@ class TestImageDraw(PillowTestCase):
draw.rectangle(list(range(4))) draw.rectangle(list(range(4)))
def test_deprecated(self): def test_deprecated(self):
im = lena().copy() im = hopper().copy()
draw = ImageDraw.Draw(im) draw = ImageDraw.Draw(im)

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, lena from helper import unittest, PillowTestCase, hopper
from PIL import Image from PIL import Image
from PIL import ImageEnhance from PIL import ImageEnhance
@ -10,10 +10,10 @@ class TestImageEnhance(PillowTestCase):
# FIXME: assert_image # FIXME: assert_image
# Implicit asserts no exception: # Implicit asserts no exception:
ImageEnhance.Color(lena()).enhance(0.5) ImageEnhance.Color(hopper()).enhance(0.5)
ImageEnhance.Contrast(lena()).enhance(0.5) ImageEnhance.Contrast(hopper()).enhance(0.5)
ImageEnhance.Brightness(lena()).enhance(0.5) ImageEnhance.Brightness(hopper()).enhance(0.5)
ImageEnhance.Sharpness(lena()).enhance(0.5) ImageEnhance.Sharpness(hopper()).enhance(0.5)
def test_crash(self): def test_crash(self):