mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Change some lena() to hopper()
This commit is contained in:
parent
eb458c7c8f
commit
b929873a62
|
@ -1,4 +1,4 @@
|
|||
from helper import *
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
# Not running this test by default. No DOS against Travis CI.
|
||||
|
||||
|
@ -39,7 +39,7 @@ def timer(func, label, *args):
|
|||
class BenchCffiAccess(PillowTestCase):
|
||||
|
||||
def test_direct(self):
|
||||
im = lena()
|
||||
im = hopper()
|
||||
im.load()
|
||||
# im = Image.new( "RGB", (2000, 2000), (1, 3, 2))
|
||||
caccess = im.im.pixel_access(False)
|
||||
|
|
|
@ -6,7 +6,7 @@ import timeit
|
|||
|
||||
|
||||
def bench(mode):
|
||||
im = helper.lena(mode)
|
||||
im = helper.hopper(mode)
|
||||
get = im.im.getpixel
|
||||
xy = 50, 50 # position shouldn't really matter
|
||||
t0 = timeit.default_timer()
|
||||
|
|
|
@ -191,11 +191,11 @@ def hopper(mode="RGB", cache={}):
|
|||
if mode == "RGB":
|
||||
im = Image.open("Tests/images/hopper.ppm")
|
||||
elif mode == "F":
|
||||
im = lena("L").convert(mode)
|
||||
im = hopper("L").convert(mode)
|
||||
elif mode[:4] == "I;16":
|
||||
im = lena("I").convert(mode)
|
||||
im = hopper("I").convert(mode)
|
||||
else:
|
||||
im = lena("RGB").convert(mode)
|
||||
im = hopper("RGB").convert(mode)
|
||||
# cache[mode] = im
|
||||
return im
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
try:
|
||||
import cffi
|
||||
|
@ -62,16 +62,16 @@ class TestCffi(PillowTestCase):
|
|||
self.assertEqual(access[(x, y)], caccess[(x, y)])
|
||||
|
||||
def test_get_vs_c(self):
|
||||
rgb = lena('RGB')
|
||||
rgb = hopper('RGB')
|
||||
rgb.load()
|
||||
self._test_get_access(rgb)
|
||||
self._test_get_access(lena('RGBA'))
|
||||
self._test_get_access(lena('L'))
|
||||
self._test_get_access(lena('LA'))
|
||||
self._test_get_access(lena('1'))
|
||||
self._test_get_access(lena('P'))
|
||||
# self._test_get_access(lena('PA')) # PA -- how do I make a PA image?
|
||||
self._test_get_access(lena('F'))
|
||||
self._test_get_access(hopper('RGBA'))
|
||||
self._test_get_access(hopper('L'))
|
||||
self._test_get_access(hopper('LA'))
|
||||
self._test_get_access(hopper('1'))
|
||||
self._test_get_access(hopper('P'))
|
||||
# self._test_get_access(hopper('PA')) # PA -- how do I make a PA image?
|
||||
self._test_get_access(hopper('F'))
|
||||
|
||||
im = Image.new('I;16', (10, 10), 40000)
|
||||
self._test_get_access(im)
|
||||
|
@ -104,16 +104,16 @@ class TestCffi(PillowTestCase):
|
|||
self.assertEqual(color, caccess[(x, y)])
|
||||
|
||||
def test_set_vs_c(self):
|
||||
rgb = lena('RGB')
|
||||
rgb = hopper('RGB')
|
||||
rgb.load()
|
||||
self._test_set_access(rgb, (255, 128, 0))
|
||||
self._test_set_access(lena('RGBA'), (255, 192, 128, 0))
|
||||
self._test_set_access(lena('L'), 128)
|
||||
self._test_set_access(lena('LA'), (128, 128))
|
||||
self._test_set_access(lena('1'), 255)
|
||||
self._test_set_access(lena('P'), 128)
|
||||
self._test_set_access(hopper('RGBA'), (255, 192, 128, 0))
|
||||
self._test_set_access(hopper('L'), 128)
|
||||
self._test_set_access(hopper('LA'), (128, 128))
|
||||
self._test_set_access(hopper('1'), 255)
|
||||
self._test_set_access(hopper('P'), 128)
|
||||
# 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)
|
||||
self._test_set_access(im, 45000)
|
||||
|
|
|
@ -2,7 +2,7 @@ from helper import unittest, PillowTestCase
|
|||
|
||||
from PIL import Image
|
||||
|
||||
test_file = "Tests/images/lena.ppm"
|
||||
TEST_FILE = "Tests/images/hopper.ppm"
|
||||
|
||||
ORIGINAL_LIMIT = Image.MAX_IMAGE_PIXELS
|
||||
|
||||
|
@ -15,7 +15,7 @@ class TestDecompressionBomb(PillowTestCase):
|
|||
def test_no_warning_small_file(self):
|
||||
# Implicit assert: no warning.
|
||||
# A warning would cause a failure.
|
||||
Image.open(test_file)
|
||||
Image.open(TEST_FILE)
|
||||
|
||||
def test_no_warning_no_limit(self):
|
||||
# Arrange
|
||||
|
@ -26,7 +26,7 @@ class TestDecompressionBomb(PillowTestCase):
|
|||
# Act / Assert
|
||||
# Implicit assert: no warning.
|
||||
# A warning would cause a failure.
|
||||
Image.open(test_file)
|
||||
Image.open(TEST_FILE)
|
||||
|
||||
def test_warning(self):
|
||||
# Arrange
|
||||
|
@ -37,7 +37,7 @@ class TestDecompressionBomb(PillowTestCase):
|
|||
# Act / Assert
|
||||
self.assert_warning(
|
||||
Image.DecompressionBombWarning,
|
||||
lambda: Image.open(test_file))
|
||||
lambda: Image.open(TEST_FILE))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
import io
|
||||
|
@ -18,16 +18,16 @@ class TestFileBmp(PillowTestCase):
|
|||
self.assertEqual(reloaded.format, "BMP")
|
||||
|
||||
def test_sanity(self):
|
||||
self.roundtrip(lena())
|
||||
self.roundtrip(hopper())
|
||||
|
||||
self.roundtrip(lena("1"))
|
||||
self.roundtrip(lena("L"))
|
||||
self.roundtrip(lena("P"))
|
||||
self.roundtrip(lena("RGB"))
|
||||
self.roundtrip(hopper("1"))
|
||||
self.roundtrip(hopper("L"))
|
||||
self.roundtrip(hopper("P"))
|
||||
self.roundtrip(hopper("RGB"))
|
||||
|
||||
def test_save_to_bytes(self):
|
||||
output = io.BytesIO()
|
||||
im = lena()
|
||||
im = hopper()
|
||||
im.save(output, "BMP")
|
||||
|
||||
output.seek(0)
|
||||
|
@ -41,7 +41,7 @@ class TestFileBmp(PillowTestCase):
|
|||
dpi = (72, 72)
|
||||
|
||||
output = io.BytesIO()
|
||||
im = lena()
|
||||
im = hopper()
|
||||
im.save(output, "BMP", dpi=dpi)
|
||||
|
||||
output.seek(0)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image, IptcImagePlugin
|
||||
|
||||
|
@ -21,7 +21,7 @@ class TestFileIptc(PillowTestCase):
|
|||
|
||||
def test_getiptcinfo_jpg_none(self):
|
||||
# Arrange
|
||||
im = lena()
|
||||
im = hopper()
|
||||
|
||||
# Act
|
||||
iptc = IptcImagePlugin.getiptcinfo(im)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -9,7 +9,7 @@ class TestFileMsp(PillowTestCase):
|
|||
|
||||
file = self.tempfile("temp.msp")
|
||||
|
||||
lena("1").save(file)
|
||||
hopper("1").save(file)
|
||||
|
||||
im = Image.open(file)
|
||||
im.load()
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
from helper import unittest, PillowTestCase, lena, imagemagick_available
|
||||
from helper import unittest, PillowTestCase, hopper, imagemagick_available
|
||||
|
||||
import os.path
|
||||
|
||||
|
||||
class TestFilePalm(PillowTestCase):
|
||||
_roundtrip = imagemagick_available()
|
||||
|
||||
|
||||
def helper_save_as_palm(self, mode):
|
||||
# Arrange
|
||||
im = lena(mode)
|
||||
im = hopper(mode)
|
||||
outfile = self.tempfile("temp_" + mode + ".palm")
|
||||
|
||||
# Act
|
||||
|
@ -21,14 +21,14 @@ class TestFilePalm(PillowTestCase):
|
|||
def roundtrip(self, mode):
|
||||
if not self._roundtrip:
|
||||
return
|
||||
|
||||
im = lena(mode)
|
||||
|
||||
im = hopper(mode)
|
||||
outfile = self.tempfile("temp.palm")
|
||||
|
||||
im.save(outfile)
|
||||
converted = self.open_withImagemagick(outfile)
|
||||
self.assert_image_equal(converted, im)
|
||||
|
||||
|
||||
|
||||
def test_monochrome(self):
|
||||
# Arrange
|
||||
|
@ -46,7 +46,7 @@ class TestFilePalm(PillowTestCase):
|
|||
self.helper_save_as_palm(mode)
|
||||
self.skipKnownBadTest("Palm P image is wrong")
|
||||
self.roundtrip(mode)
|
||||
|
||||
|
||||
def test_rgb_ioerror(self):
|
||||
# Arrange
|
||||
mode = "RGB"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -17,7 +17,7 @@ class TestFilePcx(PillowTestCase):
|
|||
|
||||
def test_sanity(self):
|
||||
for mode in ('1', 'L', 'P', 'RGB'):
|
||||
self._roundtrip(lena(mode))
|
||||
self._roundtrip(hopper(mode))
|
||||
|
||||
def test_odd(self):
|
||||
# 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'):
|
||||
# larger, odd sized images are better here to ensure that
|
||||
# we handle interrupted scan lines properly.
|
||||
self._roundtrip(lena(mode).resize((511, 511)))
|
||||
self._roundtrip(hopper(mode).resize((511, 511)))
|
||||
|
||||
def test_pil184(self):
|
||||
# Check reading of files where xmin/xmax is not zero.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
import os.path
|
||||
|
||||
|
@ -7,7 +7,7 @@ class TestFilePdf(PillowTestCase):
|
|||
|
||||
def helper_save_as_pdf(self, mode):
|
||||
# Arrange
|
||||
im = lena(mode)
|
||||
im = hopper(mode)
|
||||
outfile = self.tempfile("temp_" + mode + ".pdf")
|
||||
|
||||
# Act
|
||||
|
|
|
@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase
|
|||
from PIL import Image
|
||||
|
||||
# sample ppm stream
|
||||
file = "Tests/images/lena.ppm"
|
||||
file = "Tests/images/hopper.ppm"
|
||||
data = open(file, "rb").read()
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena, py3
|
||||
from helper import unittest, PillowTestCase, hopper, py3
|
||||
|
||||
from PIL import Image, TiffImagePlugin
|
||||
|
||||
|
@ -9,7 +9,7 @@ class TestFileTiff(PillowTestCase):
|
|||
|
||||
file = self.tempfile("temp.tif")
|
||||
|
||||
lena("RGB").save(file)
|
||||
hopper("RGB").save(file)
|
||||
|
||||
im = Image.open(file)
|
||||
im.load()
|
||||
|
@ -17,19 +17,19 @@ class TestFileTiff(PillowTestCase):
|
|||
self.assertEqual(im.size, (128, 128))
|
||||
self.assertEqual(im.format, "TIFF")
|
||||
|
||||
lena("1").save(file)
|
||||
hopper("1").save(file)
|
||||
im = Image.open(file)
|
||||
|
||||
lena("L").save(file)
|
||||
hopper("L").save(file)
|
||||
im = Image.open(file)
|
||||
|
||||
lena("P").save(file)
|
||||
hopper("P").save(file)
|
||||
im = Image.open(file)
|
||||
|
||||
lena("RGB").save(file)
|
||||
hopper("RGB").save(file)
|
||||
im = Image.open(file)
|
||||
|
||||
lena("I").save(file)
|
||||
hopper("I").save(file)
|
||||
im = Image.open(file)
|
||||
|
||||
def test_mac_tiff(self):
|
||||
|
@ -158,14 +158,14 @@ class TestFileTiff(PillowTestCase):
|
|||
im.seek(2)
|
||||
im.load()
|
||||
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):
|
||||
im = Image.open('Tests/images/multipage-lastframe.tif')
|
||||
im.load()
|
||||
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):
|
||||
# Arrange
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -40,7 +40,7 @@ class TestFileWebpAlpha(PillowTestCase):
|
|||
temp_file = self.tempfile("temp.webp")
|
||||
# temp_file = "temp.webp"
|
||||
|
||||
pil_image = lena('RGBA')
|
||||
pil_image = hopper('RGBA')
|
||||
|
||||
mask = Image.new("RGBA", (64, 64), (128, 128, 128, 128))
|
||||
# Add some partially transparent bits:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -23,7 +23,7 @@ class TestFileWebpLossless(PillowTestCase):
|
|||
def test_write_lossless_rgb(self):
|
||||
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.load()
|
||||
|
@ -34,7 +34,7 @@ class TestFileWebpLossless(PillowTestCase):
|
|||
image.load()
|
||||
image.getdata()
|
||||
|
||||
self.assert_image_equal(image, lena("RGB"))
|
||||
self.assert_image_equal(image, hopper("RGB"))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
from PIL import ImageChops
|
||||
|
@ -8,7 +8,7 @@ class TestImageChops(PillowTestCase):
|
|||
|
||||
def test_sanity(self):
|
||||
|
||||
im = lena("L")
|
||||
im = hopper("L")
|
||||
|
||||
ImageChops.constant(im, 128)
|
||||
ImageChops.duplicate(im)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
from PIL import ImageColor
|
||||
|
@ -34,7 +34,7 @@ POINTS2 = [10, 10, 20, 40, 30, 30]
|
|||
class TestImageDraw(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
im = lena("RGB").copy()
|
||||
im = hopper("RGB").copy()
|
||||
|
||||
draw = ImageDraw.ImageDraw(im)
|
||||
draw = ImageDraw.Draw(im)
|
||||
|
@ -45,7 +45,7 @@ class TestImageDraw(PillowTestCase):
|
|||
draw.rectangle(list(range(4)))
|
||||
|
||||
def test_deprecated(self):
|
||||
im = lena().copy()
|
||||
im = hopper().copy()
|
||||
|
||||
draw = ImageDraw.Draw(im)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
from PIL import ImageEnhance
|
||||
|
@ -10,10 +10,10 @@ class TestImageEnhance(PillowTestCase):
|
|||
|
||||
# FIXME: assert_image
|
||||
# Implicit asserts no exception:
|
||||
ImageEnhance.Color(lena()).enhance(0.5)
|
||||
ImageEnhance.Contrast(lena()).enhance(0.5)
|
||||
ImageEnhance.Brightness(lena()).enhance(0.5)
|
||||
ImageEnhance.Sharpness(lena()).enhance(0.5)
|
||||
ImageEnhance.Color(hopper()).enhance(0.5)
|
||||
ImageEnhance.Contrast(hopper()).enhance(0.5)
|
||||
ImageEnhance.Brightness(hopper()).enhance(0.5)
|
||||
ImageEnhance.Sharpness(hopper()).enhance(0.5)
|
||||
|
||||
def test_crash(self):
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user