Replace lena with hopper

This commit is contained in:
hugovk 2014-09-04 12:09:52 +03:00
parent e524bcc327
commit e1c33d3190

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, lena from helper import unittest, PillowTestCase, hopper
from io import BytesIO from io import BytesIO
@ -10,8 +10,8 @@ codecs = dir(Image.core)
# sample png stream # sample png stream
file = "Tests/images/lena.png" TEST_PNG_FILE = "Tests/images/hopper.png"
data = open(file, "rb").read() TEST_DATA = open(TEST_PNG_FILE, "rb").read()
# stuff to create inline PNG images # stuff to create inline PNG images
@ -58,7 +58,7 @@ class TestFilePng(PillowTestCase):
file = self.tempfile("temp.png") file = self.tempfile("temp.png")
lena("RGB").save(file) hopper("RGB").save(file)
im = Image.open(file) im = Image.open(file)
im.load() im.load()
@ -66,19 +66,19 @@ class TestFilePng(PillowTestCase):
self.assertEqual(im.size, (128, 128)) self.assertEqual(im.size, (128, 128))
self.assertEqual(im.format, "PNG") self.assertEqual(im.format, "PNG")
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_broken(self): def test_broken(self):
@ -237,17 +237,17 @@ class TestFilePng(PillowTestCase):
def test_load_verify(self): def test_load_verify(self):
# Check open/load/verify exception (@PIL150) # Check open/load/verify exception (@PIL150)
im = Image.open("Tests/images/lena.png") im = Image.open(TEST_PNG_FILE)
im.verify() im.verify()
im = Image.open("Tests/images/lena.png") im = Image.open(TEST_PNG_FILE)
im.load() im.load()
self.assertRaises(RuntimeError, lambda: im.verify()) self.assertRaises(RuntimeError, lambda: im.verify())
def test_roundtrip_dpi(self): def test_roundtrip_dpi(self):
# Check dpi roundtripping # Check dpi roundtripping
im = Image.open(file) im = Image.open(TEST_PNG_FILE)
im = roundtrip(im, dpi=(100, 100)) im = roundtrip(im, dpi=(100, 100))
self.assertEqual(im.info["dpi"], (100, 100)) self.assertEqual(im.info["dpi"], (100, 100))
@ -255,7 +255,7 @@ class TestFilePng(PillowTestCase):
def test_roundtrip_text(self): def test_roundtrip_text(self):
# Check text roundtripping # Check text roundtripping
im = Image.open(file) im = Image.open(TEST_PNG_FILE)
info = PngImagePlugin.PngInfo() info = PngImagePlugin.PngInfo()
info.add_text("TXT", "VALUE") info.add_text("TXT", "VALUE")
@ -338,7 +338,7 @@ class TestFilePng(PillowTestCase):
def test_trns_p(self): def test_trns_p(self):
# Check writing a transparency of 0, issue #528 # Check writing a transparency of 0, issue #528
im = lena('P') im = hopper('P')
im.info['transparency'] = 0 im.info['transparency'] = 0
f = self.tempfile("temp.png") f = self.tempfile("temp.png")
@ -360,7 +360,7 @@ class TestFilePng(PillowTestCase):
def test_roundtrip_icc_profile(self): def test_roundtrip_icc_profile(self):
# check that we can roundtrip the icc profile # check that we can roundtrip the icc profile
im = lena('RGB') im = hopper('RGB')
jpeg_image = Image.open('Tests/images/flower2.jpg') jpeg_image = Image.open('Tests/images/flower2.jpg')
expected_icc = jpeg_image.info['icc_profile'] expected_icc = jpeg_image.info['icc_profile']