Merge branch 'master' into imagecms-deprecations

This commit is contained in:
Hugo 2019-02-13 15:45:28 +02:00 committed by GitHub
commit 3ff70c2afc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
213 changed files with 394 additions and 833 deletions

View File

@ -47,6 +47,8 @@ matrix:
name: "3.5 Trusty PYTHONOPTIMIZE=2"
dist: trusty
env: PYTHONOPTIMIZE=2
- python: "3.8-dev"
name: "3.8-dev Xenial"
- env: DOCKER="alpine" DOCKER_TAG="master"
- env: DOCKER="arch" DOCKER_TAG="master" # contains PyQt5
- env: DOCKER="ubuntu-trusty-x86" DOCKER_TAG="master"
@ -62,6 +64,9 @@ matrix:
services:
- docker
before_install:
- if [ "$DOCKER" ]; then travis_retry docker pull pythonpillow/$DOCKER:$DOCKER_TAG; fi
install:
- |
if [ "$LINT" == "true" ]; then
@ -70,9 +75,6 @@ install:
.travis/install.sh;
fi
before_install:
- if [ "$DOCKER" ]; then travis_retry docker pull pythonpillow/$DOCKER:$DOCKER_TAG; fi
before_script:
# Qt needs a display for some of the tests, and it's only run on the system site packages install
- |

View File

@ -5,6 +5,33 @@ Changelog (Pillow)
6.0.0 (unreleased)
------------------
- Remove unnecessary unittest.main() boilerplate from test files #3631
[jdufresne]
- Exif: Seek to IFD offset #3584
[radarhere]
- Deprecate PIL.*ImagePlugin.__version__ attributes #3628
[jdufresne]
- Docs: Add note about ImageDraw operations that exceed image bounds #3620
[radarhere]
- Allow for unknown PNG chunks after image data #3558
[radarhere]
- Changed EPS subprocess stdin from devnull to None #3611
[radarhere]
- Fix possible integer overflow #3609
[cgohlke]
- Catch BaseException for resource cleanup handlers #3574
[jdufresne]
- Improve pytest configuration to allow specific tests as CLI args #3579
[jdufresne]
- Drop support for Python 3.4 #3596
[hugovk]

View File

@ -13,28 +13,20 @@ Install::
Execution
---------
**If Pillow has been built in-place**
To run an individual test::
python Tests/test_image.py
pytest Tests/test_image.py
Run all the tests from the root of the Pillow source distribution::
Or::
pytest -vx Tests
Or with coverage::
pytest -vx --cov PIL --cov-report term Tests
coverage html
open htmlcov/index.html
**If Pillow has been installed**
To run an individual test::
pytest -k Tests/test_image.py
pytest -k test_image.py
Run all the tests from the root of the Pillow source distribution::
pytest
Or with coverage::
pytest --cov PIL --cov-report term
coverage html
open htmlcov/index.html

0
Tests/__init__.py Normal file
View File

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
# Not running this test by default. No DOS against Travis CI.

View File

@ -1,4 +1,4 @@
import helper
from . import helper
import timeit
import sys

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
from PIL import Image
TEST_FILE = "Tests/images/fli_overflow.fli"

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
from __future__ import division
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
import sys
from PIL import Image

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
import sys
from PIL import Image
from io import BytesIO

View File

@ -1,5 +1,5 @@
from PIL import Image
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
class TestJ2kEncodeOverflow(PillowTestCase):

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
from io import BytesIO
import sys

View File

@ -1,6 +1,6 @@
import sys
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
# This test is not run automatically.
#

View File

@ -1,6 +1,6 @@
import sys
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
# This test is not run automatically.
#

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
from PIL import Image
TEST_FILE = "Tests/images/libtiff_segfault.tif"

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
from PIL import Image, PngImagePlugin, ImageFile
from io import BytesIO
import zlib

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
import PIL
import PIL.Image
@ -24,7 +24,3 @@ class TestSanity(PillowTestCase):
PIL.Image.new("RGB", (100, 100))
PIL.Image.new("I", (100, 100))
PIL.Image.new("F", (100, 100))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import _binary
@ -22,7 +22,3 @@ class TestBinary(PillowTestCase):
self.assertEqual(_binary.o16be(65535), b'\xff\xff')
self.assertEqual(_binary.o32be(65535), b'\x00\x00\xff\xff')
if __name__ == '__main__':
unittest.main()

View File

@ -1,5 +1,5 @@
from __future__ import print_function
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image
import os
@ -103,7 +103,3 @@ class TestBmpReference(PillowTestCase):
os.path.join(base, 'g', 'pal4rle.bmp'))
if f not in unsupported:
self.fail("Unsupported Image %s: %s" % (f, msg))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image, ImageFilter
@ -215,7 +215,3 @@ class TestBoxBlur(PillowTestCase):
passes=3,
delta=1,
)
if __name__ == '__main__':
unittest.main()

View File

@ -3,7 +3,7 @@ from __future__ import division
from array import array
from PIL import Image, ImageFilter
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
try:
import numpy
@ -519,7 +519,3 @@ class TestTransformColorLut3D(PillowTestCase):
self.assertEqual(lut.table[0:16], [
0.0, 0.0, 0.0, 0.5, 0.25, 0.0, 0.0, 0.5,
0.0, 0.0, 0.0, 0.5, 0.0, 0.16, 0.0, 0.5])
if __name__ == '__main__':
unittest.main()

View File

@ -2,7 +2,7 @@ from __future__ import division, print_function
import sys
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
from PIL import Image
@ -179,7 +179,3 @@ class TestEnvVars(PillowTestCase):
self.assert_warning(
UserWarning, Image._apply_env_variables,
{'PILLOW_BLOCKS_MAX': 'wat'})
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image
@ -83,7 +83,3 @@ class TestDecompressionCrop(PillowTestCase):
for value in error_values:
with self.assertRaises(Image.DecompressionBombError):
im.crop(value)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
from PIL import features
@ -63,7 +63,3 @@ class TestFeatures(PillowTestCase):
module = "unsupported_module"
# Act / Assert
self.assertRaises(ValueError, features.check_module, module)
if __name__ == '__main__':
unittest.main()

View File

@ -1,6 +1,6 @@
from PIL import Image
from helper import PillowTestCase, unittest
from .helper import PillowTestCase
class TestFileBlp(PillowTestCase):
@ -18,7 +18,3 @@ class TestFileBlp(PillowTestCase):
im = Image.open("Tests/images/blp/blp2_dxt1a.blp")
target = Image.open("Tests/images/blp/blp2_dxt1a.png")
self.assert_image_equal(im, target)
if __name__ == "__main__":
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image, BmpImagePlugin
import io
@ -75,7 +75,3 @@ class TestFileBmp(PillowTestCase):
im = BmpImagePlugin.DibImageFile('Tests/images/clipboard.dib')
target = Image.open('Tests/images/clipboard_target.png')
self.assert_image_equal(im, target)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import BufrStubImagePlugin, Image
@ -40,7 +40,3 @@ class TestFileBufrStub(PillowTestCase):
# Act / Assert: stub cannot save without an implemented handler
self.assertRaises(IOError, im.save, tmpfile)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image
from PIL import ContainerIO
@ -123,7 +123,3 @@ class TestFileContainer(PillowTestCase):
# Assert
self.assertEqual(data, expected)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image, CurImagePlugin
@ -29,7 +29,3 @@ class TestFileCur(PillowTestCase):
cur.fp.close()
with open(no_cursors_file, "rb") as cur.fp:
self.assertRaises(TypeError, cur._open)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image, DcxImagePlugin
@ -64,7 +64,3 @@ class TestFileDcx(PillowTestCase):
# Act / Assert
self.assertRaises(EOFError, im.seek, frame)
if __name__ == '__main__':
unittest.main()

View File

@ -1,6 +1,6 @@
from io import BytesIO
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image, DdsImagePlugin
TEST_FILE_DXT1 = "Tests/images/dxt1-rgb-4bbp-noalpha_MipMaps-1.dds"
@ -110,7 +110,3 @@ class TestFileDds(PillowTestCase):
im.load()
self.assertRaises(IOError, short_file)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
from PIL import Image, EpsImagePlugin
import io
@ -251,7 +251,3 @@ class TestFileEps(PillowTestCase):
self.assertEqual(image.mode, "RGB")
self.assertEqual(image.size, (460, 352))
self.assertEqual(image.format, "EPS")
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import FitsStubImagePlugin, Image
@ -44,7 +44,3 @@ class TestFileFitsStub(PillowTestCase):
self.assertRaises(
IOError,
FitsStubImagePlugin._save, im, dummy_fp, dummy_filename)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image, FliImagePlugin
@ -97,7 +97,3 @@ class TestFileFli(PillowTestCase):
expected = Image.open("Tests/images/a_fli.png")
self.assert_image_equal(im, expected)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
try:
from PIL import FpxImagePlugin
@ -21,7 +21,3 @@ class TestFileFpx(PillowTestCase):
ole_file = "Tests/images/test-ole-file.doc"
self.assertRaises(SyntaxError,
FpxImagePlugin.FpxImageFile, ole_file)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image
@ -14,7 +14,3 @@ class TestFileFtex(PillowTestCase):
im = Image.open('Tests/images/ftex_dxt1.ftc')
target = Image.open('Tests/images/ftex_dxt1.png')
self.assert_image_similar(im, target.convert('RGBA'), 15)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image, GbrImagePlugin
@ -17,7 +17,3 @@ class TestFileGbr(PillowTestCase):
target = Image.open('Tests/images/gbr.png')
self.assert_image_equal(target, im)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import GdImageFile
@ -20,7 +20,3 @@ class TestFileGd(PillowTestCase):
invalid_file = "Tests/images/flower.jpg"
self.assertRaises(IOError, GdImageFile.open, invalid_file)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper, netpbm_available
from .helper import unittest, PillowTestCase, hopper, netpbm_available
from PIL import Image, ImagePalette, GifImagePlugin
@ -654,7 +654,3 @@ class TestFileGif(PillowTestCase):
self.assertEqual(im.tile[0][3][0], 11) # LZW bits
# codec error prepatch
im.load()
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import GimpGradientFile
@ -119,7 +119,3 @@ class TestImage(PillowTestCase):
# load returns raw palette information
self.assertEqual(len(palette[0]), 1024)
self.assertEqual(palette[1], "RGBA")
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL.GimpPaletteFile import GimpPaletteFile
@ -28,7 +28,3 @@ class TestImage(PillowTestCase):
# Assert
self.assertEqual(mode, "RGB")
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import GribStubImagePlugin, Image
@ -40,7 +40,3 @@ class TestFileGribStub(PillowTestCase):
# Act / Assert: stub cannot save without an implemented handler
self.assertRaises(IOError, im.save, tmpfile)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Hdf5StubImagePlugin, Image
@ -44,7 +44,3 @@ class TestFileHdf5Stub(PillowTestCase):
self.assertRaises(
IOError,
Hdf5StubImagePlugin._save, im, dummy_fp, dummy_filename)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import unittest, PillowTestCase
from PIL import Image, IcnsImagePlugin
@ -121,7 +121,3 @@ class TestFileIcns(PillowTestCase):
with io.BytesIO(b'invalid\n') as fp:
self.assertRaises(SyntaxError,
IcnsImagePlugin.IcnsFile, fp)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
import io
from PIL import Image, IcoImagePlugin
@ -82,7 +82,3 @@ class TestFileIco(PillowTestCase):
self.assertEqual(
im_saved.info['sizes'],
{(16, 16), (24, 24), (32, 32), (48, 48)})
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image, ImImagePlugin
@ -69,7 +69,3 @@ class TestFileIm(PillowTestCase):
def test_number(self):
self.assertEqual(1.2, ImImagePlugin.number("1.2"))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image, IptcImagePlugin
@ -69,7 +69,3 @@ class TestFileIptc(PillowTestCase):
# Assert
self.assertEqual(mystdout.getvalue(), "61 62 63 \n")
if __name__ == '__main__':
unittest.main()

View File

@ -1,5 +1,5 @@
from helper import unittest, PillowTestCase, hopper
from helper import djpeg_available, cjpeg_available
from .helper import unittest, PillowTestCase, hopper
from .helper import djpeg_available, cjpeg_available
from io import BytesIO
import os
@ -581,6 +581,15 @@ class TestFileJpeg(PillowTestCase):
# OSError for unidentified image.
self.assertEqual(im.info.get("dpi"), (72, 72))
def test_ifd_offset_exif(self):
# Arrange
# This image has been manually hexedited to have an IFD offset of 10,
# in contrast to normal 8
im = Image.open("Tests/images/exif-ifd-offset.jpg")
# Act / Assert
self.assertEqual(im._getexif()[306], '2017:03:13 23:03:09')
@unittest.skipUnless(sys.platform.startswith('win32'), "Windows only")
class TestFileCloseW32(PillowTestCase):
@ -602,7 +611,3 @@ class TestFileCloseW32(PillowTestCase):
self.assertTrue(fp.closed)
# this should not fail, as load should have closed the file.
os.remove(tmpfile)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image, Jpeg2KImagePlugin
from io import BytesIO
@ -210,7 +210,3 @@ class TestFileJpeg2k(PillowTestCase):
# Assert
self.assertEqual(p.image.size, (640, 480))
if __name__ == '__main__':
unittest.main()

View File

@ -1,5 +1,5 @@
from __future__ import print_function
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import features
from PIL._util import py3
@ -205,7 +205,7 @@ class TestFileLibTiff(LibTiffTestCase):
# 4: "long",
# 5: "rational",
# 12: "double",
# type: dummy value
# Type: dummy value
values = {2: 'test',
3: 1,
4: 2**20,
@ -700,7 +700,3 @@ class TestFileLibTiff(LibTiffTestCase):
im = Image.open(infile)
self.assert_image_similar_tofile(im, "Tests/images/flower.jpg", 0.5)
if __name__ == '__main__':
unittest.main()

View File

@ -1,8 +1,6 @@
from helper import unittest
from PIL import Image
from test_file_libtiff import LibTiffTestCase
from .test_file_libtiff import LibTiffTestCase
class TestFileLibTiffSmall(LibTiffTestCase):
@ -46,7 +44,3 @@ class TestFileLibTiffSmall(LibTiffTestCase):
self.assertEqual(im.size, (128, 128))
self._assert_noerr(im)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image, McIdasImagePlugin
@ -28,7 +28,3 @@ class TestFileMcIdas(PillowTestCase):
self.assertEqual(im.size, (1800, 400))
im2 = Image.open(saved_file)
self.assert_image_equal(im, im2)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
from PIL import Image, ImagePalette, features
@ -64,7 +64,3 @@ class TestFileMic(PillowTestCase):
ole_file = "Tests/images/test-ole-file.doc"
self.assertRaises(SyntaxError,
MicImagePlugin.MicImageFile, ole_file)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from io import BytesIO
from PIL import Image
@ -62,6 +62,14 @@ class TestFileMpo(PillowTestCase):
self.assertEqual(mpinfo[45056], b'0100')
self.assertEqual(mpinfo[45057], 2)
def test_mp_offset(self):
# This image has been manually hexedited to have an IFD offset of 10
# in APP2 data, in contrast to normal 8
im = Image.open("Tests/images/sugarshack_ifd_offset.mpo")
mpinfo = im._getmp()
self.assertEqual(mpinfo[45056], b'0100')
self.assertEqual(mpinfo[45057], 2)
def test_mp_attribute(self):
for test_file in test_files:
im = Image.open(test_file)
@ -142,7 +150,3 @@ class TestFileMpo(PillowTestCase):
self.assertEqual(im.tell(), 1)
jpg1 = self.frame_roundtrip(im)
self.assert_image_similar(im, jpg1, 30)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
from PIL import Image, MspImagePlugin
@ -78,7 +78,3 @@ class TestFileMsp(PillowTestCase):
# Act/Assert
self.assertRaises(IOError, im.save, filename)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper, imagemagick_available
from .helper import PillowTestCase, hopper, imagemagick_available
import os.path
@ -52,7 +52,3 @@ class TestFilePalm(PillowTestCase):
# Act / Assert
self.assertRaises(IOError, self.helper_save_as_palm, mode)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image
@ -16,7 +16,3 @@ class TestFilePcd(PillowTestCase):
# target = hopper().resize((768,512))
# self.assert_image_similar(im, target, 10)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image, ImageFile, PcxImagePlugin
@ -128,7 +128,3 @@ class TestFilePcx(PillowTestCase):
for x in range(5):
px[x, 3] = 0
self._test_buffer_overflow(im)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image, PdfParser
import io
import os
@ -266,7 +266,3 @@ class TestFilePdf(PillowTestCase):
f = io.BytesIO(f.getvalue())
im.save(f, format="PDF", append=True)
self.assertGreater(len(f.getvalue()), initial_size)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import hopper, unittest, PillowTestCase
from .helper import hopper, PillowTestCase
from PIL import Image, PixarImagePlugin
@ -24,7 +24,3 @@ class TestFilePixar(PillowTestCase):
self.assertRaises(
SyntaxError,
PixarImagePlugin.PixarImageFile, invalid_file)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, PillowLeakTestCase, hopper
from .helper import unittest, PillowTestCase, PillowLeakTestCase, hopper
from PIL import Image, ImageFile, PngImagePlugin
from PIL._util import py3
@ -596,6 +596,7 @@ class TestFilePng(PillowTestCase):
im = Image.open("Tests/images/iss634.apng")
self.assertEqual(im.get_format_mimetype(), 'image/apng')
# This also tests reading unknown PNG chunks (fcTL and fdAT) in load_end
expected = Image.open("Tests/images/iss634.webp")
self.assert_image_similar(im, expected, 0.23)
@ -625,7 +626,3 @@ class TestTruncatedPngPLeaks(PillowLeakTestCase):
self._test_leak(core)
finally:
ImageFile.LOAD_TRUNCATED_IMAGES = False
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image
@ -49,7 +49,3 @@ class TestFilePpm(PillowTestCase):
with self.assertRaises(IOError):
Image.open('Tests/images/negative_size.ppm')
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import hopper, unittest, PillowTestCase
from .helper import hopper, PillowTestCase
from PIL import Image, PsdImagePlugin
@ -76,7 +76,3 @@ class TestImagePsd(PillowTestCase):
im = Image.open("Tests/images/hopper_merged.psd")
self.assertNotIn("icc_profile", im.info)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image, SgiImagePlugin
@ -89,7 +89,3 @@ class TestFileSgi(PillowTestCase):
out = self.tempfile('temp.sgi')
self.assertRaises(ValueError, im.save, out, format='sgi')
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image
from PIL import ImageSequence
@ -119,7 +119,3 @@ class TestImageSpider(PillowTestCase):
for i, frame in enumerate(ImageSequence.Iterator(im)):
if i > 1:
self.fail("Non-stack DOS file test failed")
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
from PIL import Image, SunImagePlugin
@ -45,7 +45,3 @@ class TestFileSun(PillowTestCase):
# im.save(target_file)
with Image.open(target_path) as target:
self.assert_image_equal(im, target)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image, TarIO
@ -34,7 +34,3 @@ class TestFileTar(PillowTestCase):
def test_contextmanager(self):
with TarIO.TarIO(TEST_TAR_FILE, 'hopper.jpg'):
pass
if __name__ == '__main__':
unittest.main()

View File

@ -2,7 +2,7 @@ import os
from glob import glob
from itertools import product
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image
@ -201,7 +201,3 @@ class TestFileTga(PillowTestCase):
test_im.getchannel("A").getcolors()[0][0], num_transparent)
self.assert_image_equal(im, test_im)
if __name__ == '__main__':
unittest.main()

View File

@ -2,7 +2,7 @@ import logging
from io import BytesIO
import sys
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
from PIL import Image, TiffImagePlugin
from PIL._util import py3
@ -565,7 +565,3 @@ class TestFileTiffW32(PillowTestCase):
# this should not fail, as load should have closed the file pointer,
# and close should have closed the mmap
os.remove(tmpfile)
if __name__ == '__main__':
unittest.main()

View File

@ -1,7 +1,7 @@
import io
import struct
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image, TiffImagePlugin, TiffTags
from PIL.TiffImagePlugin import _limit_rational, IFDRational
@ -247,7 +247,3 @@ class TestFileTiffMetadata(PillowTestCase):
# Should not raise ValueError.
self.assert_warning(UserWarning, lambda: ifd[277])
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import WalImageFile
@ -17,7 +17,3 @@ class TestFileWal(PillowTestCase):
self.assertEqual(im.format_description, "Quake2 Texture")
self.assertEqual(im.mode, "P")
self.assertEqual(im.size, (128, 128))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
from PIL import Image, WebPImagePlugin
@ -172,7 +172,3 @@ class TestFileWebp(PillowTestCase):
difference = sum([abs(original_value[i] - reread_value[i])
for i in range(0, 3)])
self.assertLess(difference, 5)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
from PIL import Image
@ -115,7 +115,3 @@ class TestFileWebpAlpha(PillowTestCase):
target = Image.open(file_path).convert("RGBA")
self.assert_image_similar(image, target, 25.0)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image
@ -151,7 +151,3 @@ class TestFileWebpAnimation(PillowTestCase):
self.assertEqual(im.info["duration"], dur)
self.assertEqual(im.info["timestamp"], ts)
ts -= dur
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image
@ -36,7 +36,3 @@ class TestFileWebpLossless(PillowTestCase):
image.getdata()
self.assert_image_equal(image, hopper(self.rgb_mode))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image
@ -133,7 +133,3 @@ class TestFileWebpMetadata(PillowTestCase):
self.assertEqual(iccp_data, image.info.get('icc_profile', None))
self.assertEqual(exif_data, image.info.get('exif', None))
self.assertEqual(xmp_data, image.info.get('xmp', None))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image
from PIL import WmfImagePlugin
@ -51,7 +51,3 @@ class TestFileWmf(PillowTestCase):
for ext in [".wmf", ".emf"]:
tmpfile = self.tempfile("temp"+ext)
self.assertRaises(IOError, im.save, tmpfile)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image
@ -60,7 +60,3 @@ class TestFileXbm(PillowTestCase):
# Assert
self.assertEqual(im.mode, '1')
self.assertEqual(im.size, (128, 128))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image, XpmImagePlugin
@ -33,7 +33,3 @@ class TestFileXpm(PillowTestCase):
# Assert
self.assertEqual(len(data), 16384)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import hopper, unittest, PillowTestCase
from .helper import hopper, PillowTestCase
from PIL import Image, XVThumbImagePlugin
@ -34,7 +34,3 @@ class TestFileXVThumb(PillowTestCase):
# Act / Assert
self.assertRaises(SyntaxError,
XVThumbImagePlugin.XVThumbImageFile, invalid_file)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import FontFile, BdfFontFile
@ -18,7 +18,3 @@ class TestFontBdf(PillowTestCase):
def test_invalid_file(self):
with open("Tests/images/flower.jpg", "rb") as fp:
self.assertRaises(SyntaxError, BdfFontFile.BdfFontFile, fp)
if __name__ == '__main__':
unittest.main()

View File

@ -1,5 +1,5 @@
from __future__ import division
from helper import unittest, PillowLeakTestCase
from .helper import unittest, PillowLeakTestCase
import sys
from PIL import Image, features, ImageDraw, ImageFont
@ -31,7 +31,3 @@ class TestDefaultFontLeak(TestTTypeFontLeak):
def test_leak(self):
default_font = ImageFont.load_default()
self._test_font(default_font)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image, FontFile, PcfFontFile
from PIL import ImageFont, ImageDraw
@ -79,7 +79,3 @@ class TestFontPcf(PillowTestCase):
# accept bytes instances in Py3.
if py3:
self._test_high_characters(message.encode('latin1'))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image
from PIL._util import py3
@ -129,7 +129,3 @@ class TestFormatHSV(PillowTestCase):
self.assert_image_similar(converted.getchannel(2),
comparable.getchannel(2),
3, "B conversion is wrong")
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image
@ -40,7 +40,3 @@ class TestFormatLab(PillowTestCase):
k = i.getpixel((0, 0))
self.assertEqual(k, (128, 228, 128))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import unittest, PillowTestCase, hopper
from PIL import Image
from PIL._util import py3
@ -560,7 +560,3 @@ class TestRegistry(PillowTestCase):
'DoesNotExist',
('args',),
extra=('extra',))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper, on_appveyor
from .helper import unittest, PillowTestCase, hopper, on_appveyor
from PIL import Image
import sys
@ -366,7 +366,3 @@ int main(int argc, char* argv[])
process = subprocess.Popen(['embed_pil.exe'], env=env)
process.communicate()
self.assertEqual(process.returncode, 0)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image
@ -55,7 +55,3 @@ class TestImageArray(PillowTestCase):
self.assertEqual(test("RGB"), ("RGB", (128, 100), True))
self.assertEqual(test("RGBA"), ("RGBA", (128, 100), True))
self.assertEqual(test("RGBX"), ("RGBA", (128, 100), True))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image
@ -230,7 +230,3 @@ class TestImageConvert(PillowTestCase):
# Assert
# No change
self.assert_image_equal(converted_im, im)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image
@ -40,7 +40,3 @@ class TestImageCopy(PillowTestCase):
out = im.copy()
self.assertEqual(out.mode, im.mode)
self.assertEqual(out.size, im.size)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image
@ -102,7 +102,3 @@ class TestImageCrop(PillowTestCase):
cropped = im.crop((10, 10, 20, 20))
self.assertEqual(cropped.size, (10, 10))
self.assertEqual(cropped.getdata()[2], (0, 0, 0))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, fromstring, tostring
from .helper import PillowTestCase, fromstring, tostring
from PIL import Image
@ -69,7 +69,3 @@ class TestImageDraft(PillowTestCase):
im = self.draft_roundtrip('L', (128, 128), None, (64, 64))
im.draft(None, (64, 64))
im.load()
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image, ImageFilter
@ -136,7 +136,3 @@ class TestImageFilter(PillowTestCase):
Image.merge(mode, source[:len(mode)]).filter(kernel),
Image.merge(mode, reference[:len(mode)]),
)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image
@ -13,7 +13,3 @@ class TestImageFromBytes(PillowTestCase):
def test_not_implemented(self):
self.assertRaises(NotImplementedError, Image.fromstring)
if __name__ == '__main__':
unittest.main()

View File

@ -1,5 +1,5 @@
from helper import unittest, PillowTestCase, hopper
from test_imageqt import PillowQtTestCase
from .helper import PillowTestCase, hopper
from .test_imageqt import PillowQtTestCase
from PIL import ImageQt, Image
@ -42,7 +42,3 @@ class TestFromQImage(PillowQtTestCase, PillowTestCase):
def test_sanity_p(self):
for im in self.files_to_test:
self.roundtrip(im.convert('P'))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase
from .helper import PillowTestCase
from PIL import Image
@ -18,7 +18,3 @@ class TestImageGetBands(PillowTestCase):
Image.new("CMYK", (1, 1)).getbands(), ("C", "M", "Y", "K"))
self.assertEqual(
Image.new("YCbCr", (1, 1)).getbands(), ("Y", "Cb", "Cr"))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
from PIL import Image
@ -37,7 +37,3 @@ class TestImageGetBbox(PillowTestCase):
im.paste(255, (-10, -10, 110, 110))
self.assertEqual(im.getbbox(), (0, 0, 100, 100))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
class TestImageGetColors(PillowTestCase):
@ -65,7 +65,3 @@ class TestImageGetColors(PillowTestCase):
A = im.getcolors(maxcolors=16)
A.sort()
self.assertEqual(A, expected)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, hopper
from .helper import PillowTestCase, hopper
class TestImageGetData(PillowTestCase):
@ -27,7 +27,3 @@ class TestImageGetData(PillowTestCase):
self.assertEqual(getdata("RGBA"), ((11, 13, 52, 255), 960, 960))
self.assertEqual(getdata("CMYK"), ((244, 242, 203, 0), 960, 960))
self.assertEqual(getdata("YCbCr"), ((16, 147, 123), 960, 960))
if __name__ == '__main__':
unittest.main()

Some files were not shown because too many files have changed in this diff Show More