mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-18 11:14:46 +03:00
Merge c9499c68f1
into 9e0d8b20c9
This commit is contained in:
commit
0410a75838
|
@ -4,6 +4,12 @@ from PIL import Image
|
|||
|
||||
import sys
|
||||
|
||||
# The the default version of PyPy in Trusty is PyPy 5.4.1.
|
||||
# There is a known error in it: TypeError: PyPy does not yet implement the new buffer interface (issue #2163).
|
||||
|
||||
SKIP_5_4_1_PYPY = hasattr(sys, 'pypy_version_info') and (
|
||||
sys.pypy_version_info >= (5, 4, 1, 'final', 0))
|
||||
|
||||
# sample icon file
|
||||
TEST_FILE = "Tests/images/pillow.icns"
|
||||
|
||||
|
@ -35,6 +41,7 @@ class TestFileIcns(PillowTestCase):
|
|||
self.assertEqual(reread.size, (1024, 1024))
|
||||
self.assertEqual(reread.format, "ICNS")
|
||||
|
||||
@unittest.skipIf(SKIP_5_4_1_PYPY, "PyPy does not yet implement the new buffer interface")
|
||||
def test_sizes(self):
|
||||
# Check that we can load all of the sizes, and that the final pixel
|
||||
# dimensions are as expected
|
||||
|
@ -48,6 +55,7 @@ class TestFileIcns(PillowTestCase):
|
|||
self.assertEqual(im2.mode, 'RGBA')
|
||||
self.assertEqual(im2.size, (wr, hr))
|
||||
|
||||
@unittest.skipIf(SKIP_5_4_1_PYPY, "PyPy does not yet implement the new buffer interface")
|
||||
def test_older_icon(self):
|
||||
# This icon was made with Icon Composer rather than iconutil; it still
|
||||
# uses PNG rather than JP2, however (since it was made on 10.9).
|
||||
|
@ -61,6 +69,7 @@ class TestFileIcns(PillowTestCase):
|
|||
self.assertEqual(im2.mode, 'RGBA')
|
||||
self.assertEqual(im2.size, (wr, hr))
|
||||
|
||||
@unittest.skipIf(SKIP_5_4_1_PYPY, "PyPy does not yet implement the new buffer interface")
|
||||
def test_jp2_icon(self):
|
||||
# This icon was made by using Uli Kusterer's oldiconutil to replace
|
||||
# the PNG images with JPEG 2000 ones. The advantage of doing this is
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
import io
|
||||
import sys
|
||||
from PIL import Image, IcoImagePlugin
|
||||
|
||||
# The the default version of PyPy in Trusty is PyPy 5.4.1.
|
||||
# There is a known error in it: TypeError: PyPy does not yet implement the new buffer interface (issue #2163).
|
||||
SKIP_5_4_1_PYPY = hasattr(sys, 'pypy_version_info') and (
|
||||
sys.pypy_version_info >= (5, 4, 1, 'final', 0))
|
||||
|
||||
# sample ppm stream
|
||||
TEST_ICO_FILE = "Tests/images/hopper.ico"
|
||||
|
||||
|
@ -61,6 +67,7 @@ class TestFileIco(PillowTestCase):
|
|||
# Assert
|
||||
self.assertEqual(im_saved.size, (256, 256))
|
||||
|
||||
@unittest.skipIf(SKIP_5_4_1_PYPY, "PyPy does not yet implement the new buffer interface")
|
||||
def test_only_save_relevant_sizes(self):
|
||||
"""Issue #2266 https://github.com/python-pillow/Pillow/issues/2266
|
||||
Should save in 16x16, 24x24, 32x32, 48x48 sizes
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
import sys
|
||||
from helper import unittest, PillowTestCase, hopper
|
||||
|
||||
from PIL import Image
|
||||
|
||||
# The the default version of PyPy in Trusty is PyPy 5.4.1.
|
||||
# There is a known error in it: TypeError: PyPy does not yet implement the new buffer interface (issue #2163).
|
||||
SKIP_5_4_1_PYPY = hasattr(sys, 'pypy_version_info') and (
|
||||
sys.pypy_version_info >= (5, 4, 1, 'final', 0))
|
||||
|
||||
im = hopper().resize((128, 100))
|
||||
|
||||
|
||||
|
@ -24,6 +30,7 @@ class TestImageArray(PillowTestCase):
|
|||
self.assertEqual(test("RGBA"), (3, (100, 128, 4), '|u1', 51200))
|
||||
self.assertEqual(test("RGBX"), (3, (100, 128, 4), '|u1', 51200))
|
||||
|
||||
@unittest.skipIf(SKIP_5_4_1_PYPY, "PyPy does not yet implement the new buffer interface")
|
||||
def test_fromarray(self):
|
||||
|
||||
class Wrapper(object):
|
||||
|
|
|
@ -6,6 +6,12 @@ from PIL import Image
|
|||
from PIL import ImageFile
|
||||
from PIL import EpsImagePlugin
|
||||
|
||||
import sys
|
||||
|
||||
# The the default version of PyPy in Trusty is PyPy 5.4.1.
|
||||
# There is a known error in it: TypeError: PyPy does not yet implement the new buffer interface (issue #2163).
|
||||
SKIP_5_4_1_PYPY = hasattr(sys, 'pypy_version_info') and (
|
||||
sys.pypy_version_info >= (5, 4, 1, 'final', 0))
|
||||
|
||||
codecs = dir(Image.core)
|
||||
|
||||
|
@ -71,6 +77,7 @@ class TestImageFile(PillowTestCase):
|
|||
|
||||
self.assertRaises(IOError, lambda: roundtrip("PDF"))
|
||||
|
||||
@unittest.skipIf(SKIP_5_4_1_PYPY, "PyPy does not yet implement the new buffer interface")
|
||||
def test_ico(self):
|
||||
with open('Tests/images/python.ico', 'rb') as f:
|
||||
data = f.read()
|
||||
|
|
|
@ -59,7 +59,7 @@ class TestImagePath(PillowTestCase):
|
|||
if hasattr(arr, 'tobytes'):
|
||||
p = ImagePath.Path(arr.tobytes())
|
||||
else:
|
||||
p = ImagePath.Path(arr.tostring())
|
||||
p = ImagePath.Path((arr.tostring(),))
|
||||
self.assertEqual(list(p), [(0.0, 1.0)])
|
||||
|
||||
def test_overflow_segfault(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user