mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 01:16:16 +03:00
Replace some lena() with hopper(), and temporarily disable fail-fast so we can see all failures
This commit is contained in:
parent
b929873a62
commit
8dad2b0c63
|
@ -37,6 +37,8 @@ script:
|
|||
- CFLAGS="-coverage" python setup.py build_ext --inplace
|
||||
|
||||
- coverage run --append --include=PIL/* selftest.py
|
||||
# FIXME: re-add -x option to fail fast
|
||||
# - coverage run --append --include=PIL/* -m nose -vx Tests/test_*.py
|
||||
- coverage run --append --include=PIL/* -m nose -vx Tests/test_*.py
|
||||
|
||||
after_success:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -15,7 +15,7 @@ class TestFormatHSV(PillowTestCase):
|
|||
def tuple_to_ints(self, tp):
|
||||
x,y,z = tp
|
||||
return (int(x*255.0), int(y*255.0), int(z*255.0))
|
||||
|
||||
|
||||
def test_sanity(self):
|
||||
im = Image.new('HSV', (100,100))
|
||||
|
||||
|
@ -24,7 +24,7 @@ class TestFormatHSV(PillowTestCase):
|
|||
w90 = w.rotate(90)
|
||||
|
||||
(px, h) = w.size
|
||||
|
||||
|
||||
r = Image.new('L', (px*3,h))
|
||||
g = r.copy()
|
||||
b = r.copy()
|
||||
|
@ -45,12 +45,12 @@ class TestFormatHSV(PillowTestCase):
|
|||
#print (("%d, %d -> "% (int(.75*px),int(.25*px))) + \
|
||||
# "(%s, %s, %s)"%img.getpixel((.75*px, .25*px)))
|
||||
return img
|
||||
|
||||
|
||||
def to_xxx_colorsys(self, im, func, mode):
|
||||
# convert the hard way using the library colorsys routines.
|
||||
|
||||
|
||||
(r,g,b) = im.split()
|
||||
|
||||
|
||||
if bytes is str:
|
||||
conv_func = self.str_to_float
|
||||
else:
|
||||
|
@ -69,9 +69,9 @@ class TestFormatHSV(PillowTestCase):
|
|||
new_bytes = b''.join(chr(h)+chr(s)+chr(v) for (h,s,v) in converted)
|
||||
else:
|
||||
new_bytes = b''.join(bytes(chr(h)+chr(s)+chr(v), 'latin-1') for (h,s,v) in converted)
|
||||
|
||||
|
||||
hsv = Image.frombytes(mode,r.size, new_bytes)
|
||||
|
||||
|
||||
return hsv
|
||||
|
||||
def to_hsv_colorsys(self, im):
|
||||
|
@ -87,7 +87,7 @@ class TestFormatHSV(PillowTestCase):
|
|||
|
||||
#print (im.getpixel((448, 64)))
|
||||
#print (comparable.getpixel((448, 64)))
|
||||
|
||||
|
||||
#print(im.split()[0].histogram())
|
||||
#print(comparable.split()[0].histogram())
|
||||
|
||||
|
@ -110,25 +110,25 @@ class TestFormatHSV(PillowTestCase):
|
|||
#comparable.split()[0].show()
|
||||
#print (im.getpixel((192, 64)))
|
||||
#print (comparable.getpixel((192, 64)))
|
||||
|
||||
|
||||
self.assert_image_similar(im.split()[0], comparable.split()[0],
|
||||
3, "R conversion is wrong")
|
||||
self.assert_image_similar(im.split()[1], comparable.split()[1],
|
||||
3, "G conversion is wrong")
|
||||
self.assert_image_similar(im.split()[2], comparable.split()[2],
|
||||
3, "B conversion is wrong")
|
||||
|
||||
|
||||
|
||||
|
||||
def test_convert(self):
|
||||
im = lena('RGB').convert('HSV')
|
||||
comparable = self.to_hsv_colorsys(lena('RGB'))
|
||||
im = hopper('RGB').convert('HSV')
|
||||
comparable = self.to_hsv_colorsys(hopper('RGB'))
|
||||
|
||||
# print ([ord(x) for x in im.split()[0].tobytes()[:80]])
|
||||
# print ([ord(x) for x in comparable.split()[0].tobytes()[:80]])
|
||||
|
||||
# print(im.split()[0].histogram())
|
||||
# print(comparable.split()[0].histogram())
|
||||
|
||||
|
||||
self.assert_image_similar(im.split()[0], comparable.split()[0],
|
||||
1, "Hue conversion is wrong")
|
||||
self.assert_image_similar(im.split()[1], comparable.split()[1],
|
||||
|
@ -138,10 +138,10 @@ class TestFormatHSV(PillowTestCase):
|
|||
|
||||
|
||||
def test_hsv_to_rgb(self):
|
||||
comparable = self.to_hsv_colorsys(lena('RGB'))
|
||||
comparable = self.to_hsv_colorsys(hopper('RGB'))
|
||||
converted = comparable.convert('RGB')
|
||||
comparable = self.to_rgb_colorsys(comparable)
|
||||
|
||||
|
||||
# print(converted.split()[1].histogram())
|
||||
# print(target.split()[1].histogram())
|
||||
|
||||
|
@ -156,8 +156,8 @@ class TestFormatHSV(PillowTestCase):
|
|||
self.assert_image_similar(converted.split()[2], comparable.split()[2],
|
||||
3, "B conversion is wrong")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
im = lena().resize((128, 100))
|
||||
im = hopper().resize((128, 100))
|
||||
|
||||
|
||||
class TestImageArray(PillowTestCase):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -15,13 +15,13 @@ class TestImageConvert(PillowTestCase):
|
|||
modes = "1", "L", "I", "F", "RGB", "RGBA", "RGBX", "CMYK", "YCbCr"
|
||||
|
||||
for mode in modes:
|
||||
im = lena(mode)
|
||||
im = hopper(mode)
|
||||
for mode in modes:
|
||||
convert(im, mode)
|
||||
|
||||
def test_default(self):
|
||||
|
||||
im = lena("P")
|
||||
im = hopper("P")
|
||||
self.assert_image(im, "P", im.size)
|
||||
im = im.convert()
|
||||
self.assert_image(im, "RGB", im.size)
|
||||
|
@ -36,7 +36,7 @@ class TestImageConvert(PillowTestCase):
|
|||
self.assertEqual(orig, converted)
|
||||
|
||||
def test_8bit(self):
|
||||
im = Image.open('Tests/images/lena.jpg')
|
||||
im = Image.open('Tests/images/hopper.jpg')
|
||||
self._test_float_conversion(im.convert('L'))
|
||||
|
||||
def test_16bit(self):
|
||||
|
@ -48,8 +48,8 @@ class TestImageConvert(PillowTestCase):
|
|||
self._test_float_conversion(im.convert('I'))
|
||||
|
||||
def test_rgba_p(self):
|
||||
im = lena('RGBA')
|
||||
im.putalpha(lena('L'))
|
||||
im = hopper('RGBA')
|
||||
im.putalpha(hopper('L'))
|
||||
|
||||
converted = im.convert('P')
|
||||
comparable = converted.convert('RGBA')
|
||||
|
@ -57,7 +57,7 @@ class TestImageConvert(PillowTestCase):
|
|||
self.assert_image_similar(im, comparable, 20)
|
||||
|
||||
def test_trns_p(self):
|
||||
im = lena('P')
|
||||
im = hopper('P')
|
||||
im.info['transparency'] = 0
|
||||
|
||||
f = self.tempfile('temp.png')
|
||||
|
@ -74,7 +74,7 @@ class TestImageConvert(PillowTestCase):
|
|||
|
||||
def test_trns_p_rgba(self):
|
||||
# Arrange
|
||||
im = lena('P')
|
||||
im = hopper('P')
|
||||
im.info['transparency'] = 128
|
||||
|
||||
# Act
|
||||
|
@ -84,7 +84,7 @@ class TestImageConvert(PillowTestCase):
|
|||
self.assertNotIn('transparency', rgba.info)
|
||||
|
||||
def test_trns_l(self):
|
||||
im = lena('L')
|
||||
im = hopper('L')
|
||||
im.info['transparency'] = 128
|
||||
|
||||
f = self.tempfile('temp.png')
|
||||
|
@ -104,7 +104,7 @@ class TestImageConvert(PillowTestCase):
|
|||
p.save(f)
|
||||
|
||||
def test_trns_RGB(self):
|
||||
im = lena('RGB')
|
||||
im = hopper('RGB')
|
||||
im.info['transparency'] = im.getpixel((0, 0))
|
||||
|
||||
f = self.tempfile('temp.png')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -7,7 +7,7 @@ class TestImageCopy(PillowTestCase):
|
|||
|
||||
def test_copy(self):
|
||||
def copy(mode):
|
||||
im = lena(mode)
|
||||
im = hopper(mode)
|
||||
out = im.copy()
|
||||
self.assertEqual(out.mode, mode)
|
||||
self.assertEqual(out.size, im.size)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -7,7 +7,7 @@ class TestImageCrop(PillowTestCase):
|
|||
|
||||
def test_crop(self):
|
||||
def crop(mode):
|
||||
out = lena(mode).crop((50, 50, 100, 100))
|
||||
out = hopper(mode).crop((50, 50, 100, 100))
|
||||
self.assertEqual(out.mode, mode)
|
||||
self.assertEqual(out.size, (50, 50))
|
||||
for mode in "1", "P", "L", "RGB", "I", "F":
|
||||
|
|
|
@ -3,8 +3,8 @@ from helper import unittest, PillowTestCase, fromstring, tostring
|
|||
from PIL import Image
|
||||
|
||||
codecs = dir(Image.core)
|
||||
filename = "Tests/images/lena.jpg"
|
||||
data = tostring(Image.open(filename).resize((512, 512)), "JPEG")
|
||||
fihopperme = "Tests/images/hopper.jpg"
|
||||
data = tostring(Image.open(fihopperme).resize((512, 512)), "JPEG")
|
||||
|
||||
|
||||
def draft(mode, size):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
from PIL import ImageFilter
|
||||
|
@ -9,7 +9,7 @@ class TestImageFilter(PillowTestCase):
|
|||
def test_sanity(self):
|
||||
|
||||
def filter(filter):
|
||||
im = lena("L")
|
||||
im = hopper("L")
|
||||
out = im.filter(filter)
|
||||
self.assertEqual(out.mode, im.mode)
|
||||
self.assertEqual(out.size, im.size)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -6,7 +6,7 @@ from PIL import Image
|
|||
class TestImageFromBytes(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
im1 = lena()
|
||||
im1 = hopper()
|
||||
im2 = Image.frombytes(im1.mode, im1.size, im1.tobytes())
|
||||
|
||||
self.assert_image_equal(im1, im2)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -7,7 +7,7 @@ class TestImageGetBbox(PillowTestCase):
|
|||
|
||||
def test_sanity(self):
|
||||
|
||||
bbox = lena().getbbox()
|
||||
bbox = hopper().getbbox()
|
||||
self.assertIsInstance(bbox, tuple)
|
||||
|
||||
def test_bbox(self):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
|
||||
class TestImageGetColors(PillowTestCase):
|
||||
|
@ -6,7 +6,7 @@ class TestImageGetColors(PillowTestCase):
|
|||
def test_getcolors(self):
|
||||
|
||||
def getcolors(mode, limit=None):
|
||||
im = lena(mode)
|
||||
im = hopper(mode)
|
||||
if limit:
|
||||
colors = im.getcolors(limit)
|
||||
else:
|
||||
|
@ -41,7 +41,7 @@ class TestImageGetColors(PillowTestCase):
|
|||
def test_pack(self):
|
||||
# Pack problems for small tables (@PIL209)
|
||||
|
||||
im = lena().quantize(3).convert("RGB")
|
||||
im = hopper().quantize(3).convert("RGB")
|
||||
|
||||
expected = [
|
||||
(3236, (227, 183, 147)),
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
|
||||
class TestImageGetData(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
|
||||
data = lena().getdata()
|
||||
data = hopper().getdata()
|
||||
|
||||
len(data)
|
||||
list(data)
|
||||
|
@ -15,7 +15,7 @@ class TestImageGetData(PillowTestCase):
|
|||
def test_roundtrip(self):
|
||||
|
||||
def getdata(mode):
|
||||
im = lena(mode).resize((32, 30))
|
||||
im = hopper(mode).resize((32, 30))
|
||||
data = im.getdata()
|
||||
return data[0], len(data), len(list(data))
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
|
||||
class TestImageGetExtrema(PillowTestCase):
|
||||
|
@ -6,7 +6,7 @@ class TestImageGetExtrema(PillowTestCase):
|
|||
def test_extrema(self):
|
||||
|
||||
def extrema(mode):
|
||||
return lena(mode).getextrema()
|
||||
return hopper(mode).getextrema()
|
||||
|
||||
self.assertEqual(extrema("1"), (0, 255))
|
||||
self.assertEqual(extrema("L"), (40, 235))
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from helper import unittest, PillowTestCase, lena, py3
|
||||
from helper import unittest, PillowTestCase, hopper, py3
|
||||
|
||||
|
||||
class TestImageGetIm(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
im = lena()
|
||||
im = hopper()
|
||||
type_repr = repr(type(im.getim()))
|
||||
|
||||
if py3:
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
|
||||
class TestImageGetPalette(PillowTestCase):
|
||||
|
||||
def test_palette(self):
|
||||
def palette(mode):
|
||||
p = lena(mode).getpalette()
|
||||
p = hopper(mode).getpalette()
|
||||
if p:
|
||||
return p[:10]
|
||||
return None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -7,7 +7,7 @@ class TestImageGetProjection(PillowTestCase):
|
|||
|
||||
def test_sanity(self):
|
||||
|
||||
im = lena()
|
||||
im = hopper()
|
||||
|
||||
projection = im.getprojection()
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
|
||||
class TestImageHistogram(PillowTestCase):
|
||||
|
@ -6,7 +6,7 @@ class TestImageHistogram(PillowTestCase):
|
|||
def test_histogram(self):
|
||||
|
||||
def histogram(mode):
|
||||
h = lena(mode).histogram()
|
||||
h = hopper(mode).histogram()
|
||||
return len(h), min(h), max(h)
|
||||
|
||||
self.assertEqual(histogram("1"), (256, 0, 8872))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -7,7 +7,7 @@ class TestImageMode(PillowTestCase):
|
|||
|
||||
def test_sanity(self):
|
||||
|
||||
im = lena()
|
||||
im = hopper()
|
||||
im.mode
|
||||
|
||||
from PIL import ImageMode
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
|
||||
class TestImageOffset(PillowTestCase):
|
||||
|
||||
def test_offset(self):
|
||||
|
||||
im1 = lena()
|
||||
im1 = hopper()
|
||||
|
||||
im2 = self.assert_warning(DeprecationWarning, lambda: im1.offset(10))
|
||||
self.assertEqual(im1.getpixel((0, 0)), im2.getpixel((10, 10)))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
import sys
|
||||
|
||||
|
@ -6,7 +6,7 @@ import sys
|
|||
class TestImagePoint(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
im = lena()
|
||||
im = hopper()
|
||||
|
||||
self.assertRaises(ValueError, lambda: im.point(list(range(256))))
|
||||
im.point(list(range(256))*3)
|
||||
|
@ -28,19 +28,19 @@ class TestImagePoint(PillowTestCase):
|
|||
# see https://github.com/python-pillow/Pillow/issues/484
|
||||
#self.skipKnownBadTest(msg="Too Slow on pypy", interpreter='pypy')
|
||||
|
||||
im = lena("I")
|
||||
im = hopper("I")
|
||||
im.point(list(range(256))*256, 'L')
|
||||
|
||||
def test_f_lut(self):
|
||||
""" Tests for floating point lut of 8bit gray image """
|
||||
im = lena('L')
|
||||
im = hopper('L')
|
||||
lut = [0.5 * float(x) for x in range(256)]
|
||||
|
||||
out = im.point(lut, 'F')
|
||||
|
||||
int_lut = [x//2 for x in range(256)]
|
||||
self.assert_image_equal(out.convert('L'), im.point(int_lut, 'L'))
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
import sys
|
||||
|
||||
|
@ -9,7 +9,7 @@ class TestImagePutData(PillowTestCase):
|
|||
|
||||
def test_sanity(self):
|
||||
|
||||
im1 = lena()
|
||||
im1 = hopper()
|
||||
|
||||
data = list(im1.getdata())
|
||||
|
||||
|
@ -47,7 +47,7 @@ class TestImagePutData(PillowTestCase):
|
|||
im.putdata(list(range(256))*256)
|
||||
|
||||
def test_mode_i(self):
|
||||
src = lena('L')
|
||||
src = hopper('L')
|
||||
data = list(src.getdata())
|
||||
im = Image.new('I', src.size, 0)
|
||||
im.putdata(data, 2, 256)
|
||||
|
@ -56,7 +56,7 @@ class TestImagePutData(PillowTestCase):
|
|||
self.assertEqual(list(im.getdata()), target)
|
||||
|
||||
def test_mode_F(self):
|
||||
src = lena('L')
|
||||
src = hopper('L')
|
||||
data = list(src.getdata())
|
||||
im = Image.new('F', src.size, 0)
|
||||
im.putdata(data, 2.0, 256.0)
|
||||
|
@ -64,7 +64,7 @@ class TestImagePutData(PillowTestCase):
|
|||
target = [2.0* float(elt) + 256.0 for elt in data]
|
||||
self.assertEqual(list(im.getdata()), target)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import ImagePalette
|
||||
|
||||
|
@ -7,7 +7,7 @@ class TestImagePutPalette(PillowTestCase):
|
|||
|
||||
def test_putpalette(self):
|
||||
def palette(mode):
|
||||
im = lena(mode).copy()
|
||||
im = hopper(mode).copy()
|
||||
im.putpalette(list(range(256))*3)
|
||||
p = im.getpalette()
|
||||
if p:
|
||||
|
@ -23,7 +23,7 @@ class TestImagePutPalette(PillowTestCase):
|
|||
self.assertRaises(ValueError, lambda: palette("YCbCr"))
|
||||
|
||||
def test_imagepalette(self):
|
||||
im = lena("P")
|
||||
im = hopper("P")
|
||||
im.putpalette(ImagePalette.negative())
|
||||
im.putpalette(ImagePalette.random())
|
||||
im.putpalette(ImagePalette.sepia())
|
||||
|
|
|
@ -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 TestImagePutPixel(PillowTestCase):
|
|||
|
||||
def test_sanity(self):
|
||||
|
||||
im1 = lena()
|
||||
im1 = hopper()
|
||||
im2 = Image.new(im1.mode, im1.size, 0)
|
||||
|
||||
for y in range(im1.size[1]):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -6,17 +6,17 @@ from PIL import Image
|
|||
class TestImageQuantize(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
im = lena()
|
||||
im = hopper()
|
||||
|
||||
im = im.quantize()
|
||||
self.assert_image(im, "P", im.size)
|
||||
|
||||
im = lena()
|
||||
im = im.quantize(palette=lena("P"))
|
||||
im = hopper()
|
||||
im = im.quantize(palette=hopper("P"))
|
||||
self.assert_image(im, "P", im.size)
|
||||
|
||||
def test_octree_quantize(self):
|
||||
im = lena()
|
||||
im = hopper()
|
||||
|
||||
im = im.quantize(100, Image.FASTOCTREE)
|
||||
self.assert_image(im, "P", im.size)
|
||||
|
@ -24,7 +24,7 @@ class TestImageQuantize(PillowTestCase):
|
|||
assert len(im.getcolors()) == 100
|
||||
|
||||
def test_rgba_quantize(self):
|
||||
im = lena('RGBA')
|
||||
im = hopper('RGBA')
|
||||
im.quantize()
|
||||
self.assertRaises(Exception, lambda: im.quantize(method=0))
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
|
||||
class TestImageResize(PillowTestCase):
|
||||
|
||||
def test_resize(self):
|
||||
def resize(mode, size):
|
||||
out = lena(mode).resize(size)
|
||||
out = hopper(mode).resize(size)
|
||||
self.assertEqual(out.mode, mode)
|
||||
self.assertEqual(out.size, size)
|
||||
for mode in "1", "P", "L", "RGB", "I", "F":
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
|
||||
class TestImageRotate(PillowTestCase):
|
||||
|
||||
def test_rotate(self):
|
||||
def rotate(mode):
|
||||
im = lena(mode)
|
||||
im = hopper(mode)
|
||||
out = im.rotate(45)
|
||||
self.assertEqual(out.mode, mode)
|
||||
self.assertEqual(out.size, im.size) # default rotate clips output
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -7,7 +7,7 @@ class TestImageSplit(PillowTestCase):
|
|||
|
||||
def test_split(self):
|
||||
def split(mode):
|
||||
layers = lena(mode).split()
|
||||
layers = hopper(mode).split()
|
||||
return [(i.mode, i.size[0], i.size[1]) for i in layers]
|
||||
self.assertEqual(split("1"), [('1', 128, 128)])
|
||||
self.assertEqual(split("L"), [('L', 128, 128)])
|
||||
|
@ -30,16 +30,16 @@ class TestImageSplit(PillowTestCase):
|
|||
|
||||
def test_split_merge(self):
|
||||
def split_merge(mode):
|
||||
return Image.merge(mode, lena(mode).split())
|
||||
self.assert_image_equal(lena("1"), split_merge("1"))
|
||||
self.assert_image_equal(lena("L"), split_merge("L"))
|
||||
self.assert_image_equal(lena("I"), split_merge("I"))
|
||||
self.assert_image_equal(lena("F"), split_merge("F"))
|
||||
self.assert_image_equal(lena("P"), split_merge("P"))
|
||||
self.assert_image_equal(lena("RGB"), split_merge("RGB"))
|
||||
self.assert_image_equal(lena("RGBA"), split_merge("RGBA"))
|
||||
self.assert_image_equal(lena("CMYK"), split_merge("CMYK"))
|
||||
self.assert_image_equal(lena("YCbCr"), split_merge("YCbCr"))
|
||||
return Image.merge(mode, hopper(mode).split())
|
||||
self.assert_image_equal(hopper("1"), split_merge("1"))
|
||||
self.assert_image_equal(hopper("L"), split_merge("L"))
|
||||
self.assert_image_equal(hopper("I"), split_merge("I"))
|
||||
self.assert_image_equal(hopper("F"), split_merge("F"))
|
||||
self.assert_image_equal(hopper("P"), split_merge("P"))
|
||||
self.assert_image_equal(hopper("RGB"), split_merge("RGB"))
|
||||
self.assert_image_equal(hopper("RGBA"), split_merge("RGBA"))
|
||||
self.assert_image_equal(hopper("CMYK"), split_merge("CMYK"))
|
||||
self.assert_image_equal(hopper("YCbCr"), split_merge("YCbCr"))
|
||||
|
||||
def test_split_open(self):
|
||||
codecs = dir(Image.core)
|
||||
|
@ -50,7 +50,7 @@ class TestImageSplit(PillowTestCase):
|
|||
file = self.tempfile("temp.pcx")
|
||||
|
||||
def split_open(mode):
|
||||
lena(mode).save(file)
|
||||
hopper(mode).save(file)
|
||||
im = Image.open(file)
|
||||
return len(im.split())
|
||||
self.assertEqual(split_open("1"), 1)
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
|
||||
class TestImageThumbnail(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
|
||||
im = lena()
|
||||
im = hopper()
|
||||
im.thumbnail((100, 100))
|
||||
|
||||
self.assert_image(im, im.mode, (100, 100))
|
||||
|
||||
def test_aspect(self):
|
||||
|
||||
im = lena()
|
||||
im = hopper()
|
||||
im.thumbnail((100, 100))
|
||||
self.assert_image(im, im.mode, (100, 100))
|
||||
|
||||
im = lena().resize((128, 256))
|
||||
im = hopper().resize((128, 256))
|
||||
im.thumbnail((100, 100))
|
||||
self.assert_image(im, im.mode, (50, 100))
|
||||
|
||||
im = lena().resize((128, 256))
|
||||
im = hopper().resize((128, 256))
|
||||
im.thumbnail((50, 100))
|
||||
self.assert_image(im, im.mode, (50, 100))
|
||||
|
||||
im = lena().resize((256, 128))
|
||||
im = hopper().resize((256, 128))
|
||||
im.thumbnail((100, 100))
|
||||
self.assert_image(im, im.mode, (100, 50))
|
||||
|
||||
im = lena().resize((256, 128))
|
||||
im = hopper().resize((256, 128))
|
||||
im.thumbnail((100, 50))
|
||||
self.assert_image(im, im.mode, (100, 50))
|
||||
|
||||
im = lena().resize((128, 128))
|
||||
im = hopper().resize((128, 128))
|
||||
im.thumbnail((100, 100))
|
||||
self.assert_image(im, im.mode, (100, 100))
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
from helper import unittest, PillowTestCase, lena, fromstring
|
||||
from helper import unittest, PillowTestCase, hopper, fromstring
|
||||
|
||||
|
||||
class TestImageToBitmap(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
|
||||
self.assertRaises(ValueError, lambda: lena().tobitmap())
|
||||
lena().convert("1").tobitmap()
|
||||
self.assertRaises(ValueError, lambda: hopper().tobitmap())
|
||||
hopper().convert("1").tobitmap()
|
||||
|
||||
im1 = lena().convert("1")
|
||||
im1 = hopper().convert("1")
|
||||
|
||||
bitmap = im1.tobitmap()
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
|
||||
class TestImageToBytes(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
data = lena().tobytes()
|
||||
data = hopper().tobytes()
|
||||
self.assertTrue(isinstance(data, bytes))
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -22,7 +22,7 @@ class TestImageTransform(PillowTestCase):
|
|||
im.transform((100, 100), transform)
|
||||
|
||||
def test_extent(self):
|
||||
im = lena('RGB')
|
||||
im = hopper('RGB')
|
||||
(w, h) = im.size
|
||||
transformed = im.transform(im.size, Image.EXTENT,
|
||||
(0, 0,
|
||||
|
@ -36,7 +36,7 @@ class TestImageTransform(PillowTestCase):
|
|||
|
||||
def test_quad(self):
|
||||
# one simple quad transform, equivalent to scale & crop upper left quad
|
||||
im = lena('RGB')
|
||||
im = hopper('RGB')
|
||||
(w, h) = im.size
|
||||
transformed = im.transform(im.size, Image.QUAD,
|
||||
(0, 0, 0, h//2,
|
||||
|
@ -49,8 +49,8 @@ class TestImageTransform(PillowTestCase):
|
|||
self.assert_image_equal(transformed, scaled)
|
||||
|
||||
def test_mesh(self):
|
||||
# this should be a checkerboard of halfsized lenas in ul, lr
|
||||
im = lena('RGBA')
|
||||
# this should be a checkerboard of halfsized hoppers in ul, lr
|
||||
im = hopper('RGBA')
|
||||
(w, h) = im.size
|
||||
transformed = im.transform(im.size, Image.MESH,
|
||||
[((0, 0, w//2, h//2), # box
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -13,7 +13,7 @@ class TestImageTranspose(PillowTestCase):
|
|||
|
||||
def test_sanity(self):
|
||||
|
||||
im = lena()
|
||||
im = hopper()
|
||||
|
||||
im.transpose(FLIP_LEFT_RIGHT)
|
||||
im.transpose(FLIP_TOP_BOTTOM)
|
||||
|
@ -24,7 +24,7 @@ class TestImageTranspose(PillowTestCase):
|
|||
|
||||
def test_roundtrip(self):
|
||||
|
||||
im = lena()
|
||||
im = hopper()
|
||||
|
||||
def transpose(first, second):
|
||||
return im.transpose(first).transpose(second)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena, fromstring, tostring
|
||||
from helper import unittest, PillowTestCase, hopper, fromstring, tostring
|
||||
|
||||
from io import BytesIO
|
||||
|
||||
|
@ -20,7 +20,7 @@ class TestImageFile(PillowTestCase):
|
|||
|
||||
def roundtrip(format):
|
||||
|
||||
im = lena("L").resize((1000, 1000))
|
||||
im = hopper("L").resize((1000, 1000))
|
||||
if format in ("MSP", "XBM"):
|
||||
im = im.convert("1")
|
||||
|
||||
|
@ -73,7 +73,7 @@ class TestImageFile(PillowTestCase):
|
|||
|
||||
def test_safeblock(self):
|
||||
|
||||
im1 = lena()
|
||||
im1 = hopper()
|
||||
|
||||
if "zip_encoder" not in codecs:
|
||||
self.skipTest("PNG (zlib) encoder not available")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena, tostring
|
||||
from helper import unittest, PillowTestCase, hopper, tostring
|
||||
|
||||
from PIL import Image
|
||||
from PIL import ImageFileIO
|
||||
|
@ -19,7 +19,7 @@ class TestImageFileIo(PillowTestCase):
|
|||
def close(self):
|
||||
pass
|
||||
|
||||
im1 = lena()
|
||||
im1 = hopper()
|
||||
|
||||
io = ImageFileIO.ImageFileIO(DumbFile(tostring(im1, "PPM")))
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import ImageOps
|
||||
|
||||
|
@ -14,65 +14,65 @@ class TestImageOps(PillowTestCase):
|
|||
|
||||
def test_sanity(self):
|
||||
|
||||
ImageOps.autocontrast(lena("L"))
|
||||
ImageOps.autocontrast(lena("RGB"))
|
||||
ImageOps.autocontrast(hopper("L"))
|
||||
ImageOps.autocontrast(hopper("RGB"))
|
||||
|
||||
ImageOps.autocontrast(lena("L"), cutoff=10)
|
||||
ImageOps.autocontrast(lena("L"), ignore=[0, 255])
|
||||
ImageOps.autocontrast(hopper("L"), cutoff=10)
|
||||
ImageOps.autocontrast(hopper("L"), ignore=[0, 255])
|
||||
|
||||
ImageOps.colorize(lena("L"), (0, 0, 0), (255, 255, 255))
|
||||
ImageOps.colorize(lena("L"), "black", "white")
|
||||
ImageOps.colorize(hopper("L"), (0, 0, 0), (255, 255, 255))
|
||||
ImageOps.colorize(hopper("L"), "black", "white")
|
||||
|
||||
ImageOps.crop(lena("L"), 1)
|
||||
ImageOps.crop(lena("RGB"), 1)
|
||||
ImageOps.crop(hopper("L"), 1)
|
||||
ImageOps.crop(hopper("RGB"), 1)
|
||||
|
||||
ImageOps.deform(lena("L"), self.deformer)
|
||||
ImageOps.deform(lena("RGB"), self.deformer)
|
||||
ImageOps.deform(hopper("L"), self.deformer)
|
||||
ImageOps.deform(hopper("RGB"), self.deformer)
|
||||
|
||||
ImageOps.equalize(lena("L"))
|
||||
ImageOps.equalize(lena("RGB"))
|
||||
ImageOps.equalize(hopper("L"))
|
||||
ImageOps.equalize(hopper("RGB"))
|
||||
|
||||
ImageOps.expand(lena("L"), 1)
|
||||
ImageOps.expand(lena("RGB"), 1)
|
||||
ImageOps.expand(lena("L"), 2, "blue")
|
||||
ImageOps.expand(lena("RGB"), 2, "blue")
|
||||
ImageOps.expand(hopper("L"), 1)
|
||||
ImageOps.expand(hopper("RGB"), 1)
|
||||
ImageOps.expand(hopper("L"), 2, "blue")
|
||||
ImageOps.expand(hopper("RGB"), 2, "blue")
|
||||
|
||||
ImageOps.fit(lena("L"), (128, 128))
|
||||
ImageOps.fit(lena("RGB"), (128, 128))
|
||||
ImageOps.fit(hopper("L"), (128, 128))
|
||||
ImageOps.fit(hopper("RGB"), (128, 128))
|
||||
|
||||
ImageOps.flip(lena("L"))
|
||||
ImageOps.flip(lena("RGB"))
|
||||
ImageOps.flip(hopper("L"))
|
||||
ImageOps.flip(hopper("RGB"))
|
||||
|
||||
ImageOps.grayscale(lena("L"))
|
||||
ImageOps.grayscale(lena("RGB"))
|
||||
ImageOps.grayscale(hopper("L"))
|
||||
ImageOps.grayscale(hopper("RGB"))
|
||||
|
||||
ImageOps.invert(lena("L"))
|
||||
ImageOps.invert(lena("RGB"))
|
||||
ImageOps.invert(hopper("L"))
|
||||
ImageOps.invert(hopper("RGB"))
|
||||
|
||||
ImageOps.mirror(lena("L"))
|
||||
ImageOps.mirror(lena("RGB"))
|
||||
ImageOps.mirror(hopper("L"))
|
||||
ImageOps.mirror(hopper("RGB"))
|
||||
|
||||
ImageOps.posterize(lena("L"), 4)
|
||||
ImageOps.posterize(lena("RGB"), 4)
|
||||
ImageOps.posterize(hopper("L"), 4)
|
||||
ImageOps.posterize(hopper("RGB"), 4)
|
||||
|
||||
ImageOps.solarize(lena("L"))
|
||||
ImageOps.solarize(lena("RGB"))
|
||||
ImageOps.solarize(hopper("L"))
|
||||
ImageOps.solarize(hopper("RGB"))
|
||||
|
||||
def test_1pxfit(self):
|
||||
# Division by zero in equalize if image is 1 pixel high
|
||||
newimg = ImageOps.fit(lena("RGB").resize((1, 1)), (35, 35))
|
||||
newimg = ImageOps.fit(hopper("RGB").resize((1, 1)), (35, 35))
|
||||
self.assertEqual(newimg.size, (35, 35))
|
||||
|
||||
newimg = ImageOps.fit(lena("RGB").resize((1, 100)), (35, 35))
|
||||
newimg = ImageOps.fit(hopper("RGB").resize((1, 100)), (35, 35))
|
||||
self.assertEqual(newimg.size, (35, 35))
|
||||
|
||||
newimg = ImageOps.fit(lena("RGB").resize((100, 1)), (35, 35))
|
||||
newimg = ImageOps.fit(hopper("RGB").resize((100, 1)), (35, 35))
|
||||
self.assertEqual(newimg.size, (35, 35))
|
||||
|
||||
def test_pil163(self):
|
||||
# Division by zero in equalize if < 255 pixels in image (@PIL163)
|
||||
|
||||
i = lena("RGB").resize((15, 16))
|
||||
i = hopper("RGB").resize((15, 16))
|
||||
|
||||
ImageOps.equalize(i.convert("L"))
|
||||
ImageOps.equalize(i.convert("P"))
|
||||
|
|
|
@ -4,7 +4,7 @@ from PIL import Image
|
|||
from PIL import ImageOps
|
||||
from PIL import ImageFilter
|
||||
|
||||
im = Image.open("Tests/images/lena.ppm")
|
||||
im = Image.open("Tests/images/hopper.ppm")
|
||||
|
||||
|
||||
class TestImageOpsUsm(PillowTestCase):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
try:
|
||||
from PIL import ImageQt
|
||||
|
@ -44,7 +44,7 @@ class TestImageQt(PillowTestCase):
|
|||
|
||||
def test_image(self):
|
||||
for mode in ('1', 'RGB', 'RGBA', 'L', 'P'):
|
||||
ImageQt.ImageQt(lena(mode))
|
||||
ImageQt.ImageQt(hopper(mode))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image, ImageSequence, TiffImagePlugin
|
||||
|
||||
|
@ -9,7 +9,7 @@ class TestImageSequence(PillowTestCase):
|
|||
|
||||
file = self.tempfile("temp.im")
|
||||
|
||||
im = lena("RGB")
|
||||
im = hopper("RGB")
|
||||
im.save(file)
|
||||
|
||||
seq = ImageSequence.Iterator(im)
|
||||
|
@ -31,14 +31,14 @@ class TestImageSequence(PillowTestCase):
|
|||
self.assertEqual(index, im.tell())
|
||||
frame.convert('RGB')
|
||||
Image.DEBUG=False
|
||||
|
||||
|
||||
def test_tiff(self):
|
||||
#self._test_multipage_tiff(True)
|
||||
self._test_multipage_tiff(False)
|
||||
|
||||
def test_libtiff(self):
|
||||
codecs = dir(Image.core)
|
||||
|
||||
|
||||
if "libtiff_encoder" not in codecs or "libtiff_decoder" not in codecs:
|
||||
self.skipTest("tiff support not available")
|
||||
|
||||
|
@ -46,7 +46,7 @@ class TestImageSequence(PillowTestCase):
|
|||
#self._test_multipage_tiff(True)
|
||||
self._test_multipage_tiff(False)
|
||||
TiffImagePlugin.READ_LIBTIFF = False
|
||||
|
||||
|
||||
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
|
||||
from PIL import ImageStat
|
||||
|
@ -8,7 +8,7 @@ class TestImageStat(PillowTestCase):
|
|||
|
||||
def test_sanity(self):
|
||||
|
||||
im = lena()
|
||||
im = hopper()
|
||||
|
||||
st = ImageStat.Stat(im)
|
||||
st = ImageStat.Stat(im.histogram())
|
||||
|
@ -28,9 +28,9 @@ class TestImageStat(PillowTestCase):
|
|||
|
||||
self.assertRaises(TypeError, lambda: ImageStat.Stat(1))
|
||||
|
||||
def test_lena(self):
|
||||
def test_hopper(self):
|
||||
|
||||
im = lena()
|
||||
im = hopper()
|
||||
|
||||
st = ImageStat.Stat(im)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -19,7 +19,7 @@ import locale
|
|||
|
||||
# one of string.whitespace is not freely convertable into ascii.
|
||||
|
||||
path = "Tests/images/lena.jpg"
|
||||
path = "Tests/images/hopper.jpg"
|
||||
|
||||
|
||||
class TestLocale(PillowTestCase):
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
||||
class TestModeI16(PillowTestCase):
|
||||
|
||||
original = lena().resize((32,32)).convert('I')
|
||||
original = hopper().resize((32,32)).convert('I')
|
||||
|
||||
def verify(self, im1):
|
||||
im2 = self.original.copy()
|
||||
|
@ -39,10 +39,10 @@ class TestModeI16(PillowTestCase):
|
|||
imOut = imIn.transform((w, h), Image.EXTENT, (0, 0, w, h))
|
||||
self.verify(imOut) # transform
|
||||
|
||||
filename = self.tempfile("temp.im")
|
||||
imIn.save(filename)
|
||||
fihopperme = self.tempfile("temp.im")
|
||||
imIn.save(fihopperme)
|
||||
|
||||
imOut = Image.open(filename)
|
||||
imOut = Image.open(fihopperme)
|
||||
|
||||
self.verify(imIn)
|
||||
self.verify(imOut)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from helper import unittest, PillowTestCase, lena
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
@ -90,7 +90,7 @@ class TestNumpy(PillowTestCase):
|
|||
def test_to_array(self):
|
||||
|
||||
def _to_array(mode, dtype):
|
||||
img = lena(mode)
|
||||
img = hopper(mode)
|
||||
np_img = numpy.array(img)
|
||||
self._test_img_equals_nparray(img, np_img)
|
||||
self.assertEqual(np_img.dtype, numpy.dtype(dtype))
|
||||
|
@ -117,7 +117,7 @@ class TestNumpy(PillowTestCase):
|
|||
data = list(range(256))*3
|
||||
lut = numpy.array(data, dtype='uint8')
|
||||
|
||||
im = lena()
|
||||
im = hopper()
|
||||
|
||||
im.point(lut)
|
||||
|
||||
|
|
|
@ -6,20 +6,20 @@ from PIL import Image
|
|||
class TestPickle(PillowTestCase):
|
||||
|
||||
def helper_pickle_file(self, pickle, protocol=0):
|
||||
im = Image.open('Tests/images/lena.jpg')
|
||||
filename = self.tempfile('temp.pkl')
|
||||
im = Image.open('Tests/images/hopper.jpg')
|
||||
fihopperme = self.tempfile('temp.pkl')
|
||||
|
||||
# Act
|
||||
with open(filename, 'wb') as f:
|
||||
with open(fihopperme, 'wb') as f:
|
||||
pickle.dump(im, f, protocol)
|
||||
with open(filename, 'rb') as f:
|
||||
with open(fihopperme, 'rb') as f:
|
||||
loaded_im = pickle.load(f)
|
||||
|
||||
# Assert
|
||||
self.assertEqual(im, loaded_im)
|
||||
|
||||
def helper_pickle_string(
|
||||
self, pickle, protocol=0, file='Tests/images/lena.jpg'):
|
||||
self, pickle, protocol=0, file='Tests/images/hopper.jpg'):
|
||||
im = Image.open(file)
|
||||
|
||||
# Act
|
||||
|
|
|
@ -9,7 +9,7 @@ try:
|
|||
except:
|
||||
format = "PNG"
|
||||
|
||||
im = Image.open("Tests/images/lena.ppm")
|
||||
im = Image.open("Tests/images/hopper.ppm")
|
||||
im.load()
|
||||
|
||||
queue = queue.Queue()
|
||||
|
|
Loading…
Reference in New Issue
Block a user