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

View File

@ -13,28 +13,20 @@ Install::
Execution Execution
--------- ---------
**If Pillow has been built in-place**
To run an individual test:: 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 pytest -k test_image.py
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
Run all the tests from the root of the Pillow source distribution:: Run all the tests from the root of the Pillow source distribution::
pytest 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. # 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 timeit
import sys import sys

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
from PIL import Image from PIL import Image
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
class TestJ2kEncodeOverflow(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 from io import BytesIO
import sys import sys

View File

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

View File

@ -1,6 +1,6 @@
import sys import sys
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
# This test is not run automatically. # 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 from PIL import Image
TEST_FILE = "Tests/images/libtiff_segfault.tif" 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 PIL import Image, PngImagePlugin, ImageFile
from io import BytesIO from io import BytesIO
import zlib 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
import PIL.Image import PIL.Image
@ -24,7 +24,3 @@ class TestSanity(PillowTestCase):
PIL.Image.new("RGB", (100, 100)) PIL.Image.new("RGB", (100, 100))
PIL.Image.new("I", (100, 100)) PIL.Image.new("I", (100, 100))
PIL.Image.new("F", (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 from PIL import _binary
@ -22,7 +22,3 @@ class TestBinary(PillowTestCase):
self.assertEqual(_binary.o16be(65535), b'\xff\xff') self.assertEqual(_binary.o16be(65535), b'\xff\xff')
self.assertEqual(_binary.o32be(65535), b'\x00\x00\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 __future__ import print_function
from helper import unittest, PillowTestCase from .helper import PillowTestCase
from PIL import Image from PIL import Image
import os import os
@ -103,7 +103,3 @@ class TestBmpReference(PillowTestCase):
os.path.join(base, 'g', 'pal4rle.bmp')) os.path.join(base, 'g', 'pal4rle.bmp'))
if f not in unsupported: if f not in unsupported:
self.fail("Unsupported Image %s: %s" % (f, msg)) 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 from PIL import Image, ImageFilter
@ -215,7 +215,3 @@ class TestBoxBlur(PillowTestCase):
passes=3, passes=3,
delta=1, delta=1,
) )
if __name__ == '__main__':
unittest.main()

View File

@ -3,7 +3,7 @@ from __future__ import division
from array import array from array import array
from PIL import Image, ImageFilter from PIL import Image, ImageFilter
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
try: try:
import numpy import numpy
@ -519,7 +519,3 @@ class TestTransformColorLut3D(PillowTestCase):
self.assertEqual(lut.table[0:16], [ 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.25, 0.0, 0.0, 0.5,
0.0, 0.0, 0.0, 0.5, 0.0, 0.16, 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 import sys
from helper import unittest, PillowTestCase from .helper import unittest, PillowTestCase
from PIL import Image from PIL import Image
@ -179,7 +179,3 @@ class TestEnvVars(PillowTestCase):
self.assert_warning( self.assert_warning(
UserWarning, Image._apply_env_variables, UserWarning, Image._apply_env_variables,
{'PILLOW_BLOCKS_MAX': 'wat'}) {'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 from PIL import Image
@ -83,7 +83,3 @@ class TestDecompressionCrop(PillowTestCase):
for value in error_values: for value in error_values:
with self.assertRaises(Image.DecompressionBombError): with self.assertRaises(Image.DecompressionBombError):
im.crop(value) 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 from PIL import features
@ -63,7 +63,3 @@ class TestFeatures(PillowTestCase):
module = "unsupported_module" module = "unsupported_module"
# Act / Assert # Act / Assert
self.assertRaises(ValueError, features.check_module, module) self.assertRaises(ValueError, features.check_module, module)
if __name__ == '__main__':
unittest.main()

View File

@ -1,6 +1,6 @@
from PIL import Image from PIL import Image
from helper import PillowTestCase, unittest from .helper import PillowTestCase
class TestFileBlp(PillowTestCase): class TestFileBlp(PillowTestCase):
@ -18,7 +18,3 @@ class TestFileBlp(PillowTestCase):
im = Image.open("Tests/images/blp/blp2_dxt1a.blp") im = Image.open("Tests/images/blp/blp2_dxt1a.blp")
target = Image.open("Tests/images/blp/blp2_dxt1a.png") target = Image.open("Tests/images/blp/blp2_dxt1a.png")
self.assert_image_equal(im, target) 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 from PIL import Image, BmpImagePlugin
import io import io
@ -75,7 +75,3 @@ class TestFileBmp(PillowTestCase):
im = BmpImagePlugin.DibImageFile('Tests/images/clipboard.dib') im = BmpImagePlugin.DibImageFile('Tests/images/clipboard.dib')
target = Image.open('Tests/images/clipboard_target.png') target = Image.open('Tests/images/clipboard_target.png')
self.assert_image_equal(im, target) 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 from PIL import BufrStubImagePlugin, Image
@ -40,7 +40,3 @@ class TestFileBufrStub(PillowTestCase):
# Act / Assert: stub cannot save without an implemented handler # Act / Assert: stub cannot save without an implemented handler
self.assertRaises(IOError, im.save, tmpfile) 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 Image
from PIL import ContainerIO from PIL import ContainerIO
@ -123,7 +123,3 @@ class TestFileContainer(PillowTestCase):
# Assert # Assert
self.assertEqual(data, expected) 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 from PIL import Image, CurImagePlugin
@ -29,7 +29,3 @@ class TestFileCur(PillowTestCase):
cur.fp.close() cur.fp.close()
with open(no_cursors_file, "rb") as cur.fp: with open(no_cursors_file, "rb") as cur.fp:
self.assertRaises(TypeError, cur._open) 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 from PIL import Image, DcxImagePlugin
@ -64,7 +64,3 @@ class TestFileDcx(PillowTestCase):
# Act / Assert # Act / Assert
self.assertRaises(EOFError, im.seek, frame) self.assertRaises(EOFError, im.seek, frame)
if __name__ == '__main__':
unittest.main()

View File

@ -1,6 +1,6 @@
from io import BytesIO from io import BytesIO
from helper import unittest, PillowTestCase from .helper import PillowTestCase
from PIL import Image, DdsImagePlugin from PIL import Image, DdsImagePlugin
TEST_FILE_DXT1 = "Tests/images/dxt1-rgb-4bbp-noalpha_MipMaps-1.dds" TEST_FILE_DXT1 = "Tests/images/dxt1-rgb-4bbp-noalpha_MipMaps-1.dds"
@ -110,7 +110,3 @@ class TestFileDds(PillowTestCase):
im.load() im.load()
self.assertRaises(IOError, short_file) 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 from PIL import Image, EpsImagePlugin
import io import io
@ -251,7 +251,3 @@ class TestFileEps(PillowTestCase):
self.assertEqual(image.mode, "RGB") self.assertEqual(image.mode, "RGB")
self.assertEqual(image.size, (460, 352)) self.assertEqual(image.size, (460, 352))
self.assertEqual(image.format, "EPS") 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 from PIL import FitsStubImagePlugin, Image
@ -44,7 +44,3 @@ class TestFileFitsStub(PillowTestCase):
self.assertRaises( self.assertRaises(
IOError, IOError,
FitsStubImagePlugin._save, im, dummy_fp, dummy_filename) 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 from PIL import Image, FliImagePlugin
@ -97,7 +97,3 @@ class TestFileFli(PillowTestCase):
expected = Image.open("Tests/images/a_fli.png") expected = Image.open("Tests/images/a_fli.png")
self.assert_image_equal(im, expected) 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: try:
from PIL import FpxImagePlugin from PIL import FpxImagePlugin
@ -21,7 +21,3 @@ class TestFileFpx(PillowTestCase):
ole_file = "Tests/images/test-ole-file.doc" ole_file = "Tests/images/test-ole-file.doc"
self.assertRaises(SyntaxError, self.assertRaises(SyntaxError,
FpxImagePlugin.FpxImageFile, ole_file) 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 from PIL import Image
@ -14,7 +14,3 @@ class TestFileFtex(PillowTestCase):
im = Image.open('Tests/images/ftex_dxt1.ftc') im = Image.open('Tests/images/ftex_dxt1.ftc')
target = Image.open('Tests/images/ftex_dxt1.png') target = Image.open('Tests/images/ftex_dxt1.png')
self.assert_image_similar(im, target.convert('RGBA'), 15) 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 from PIL import Image, GbrImagePlugin
@ -17,7 +17,3 @@ class TestFileGbr(PillowTestCase):
target = Image.open('Tests/images/gbr.png') target = Image.open('Tests/images/gbr.png')
self.assert_image_equal(target, im) 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 from PIL import GdImageFile
@ -20,7 +20,3 @@ class TestFileGd(PillowTestCase):
invalid_file = "Tests/images/flower.jpg" invalid_file = "Tests/images/flower.jpg"
self.assertRaises(IOError, GdImageFile.open, invalid_file) 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 from PIL import Image, ImagePalette, GifImagePlugin
@ -654,7 +654,3 @@ class TestFileGif(PillowTestCase):
self.assertEqual(im.tile[0][3][0], 11) # LZW bits self.assertEqual(im.tile[0][3][0], 11) # LZW bits
# codec error prepatch # codec error prepatch
im.load() 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 from PIL import GimpGradientFile
@ -119,7 +119,3 @@ class TestImage(PillowTestCase):
# load returns raw palette information # load returns raw palette information
self.assertEqual(len(palette[0]), 1024) self.assertEqual(len(palette[0]), 1024)
self.assertEqual(palette[1], "RGBA") 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 from PIL.GimpPaletteFile import GimpPaletteFile
@ -28,7 +28,3 @@ class TestImage(PillowTestCase):
# Assert # Assert
self.assertEqual(mode, "RGB") 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 from PIL import GribStubImagePlugin, Image
@ -40,7 +40,3 @@ class TestFileGribStub(PillowTestCase):
# Act / Assert: stub cannot save without an implemented handler # Act / Assert: stub cannot save without an implemented handler
self.assertRaises(IOError, im.save, tmpfile) 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 from PIL import Hdf5StubImagePlugin, Image
@ -44,7 +44,3 @@ class TestFileHdf5Stub(PillowTestCase):
self.assertRaises( self.assertRaises(
IOError, IOError,
Hdf5StubImagePlugin._save, im, dummy_fp, dummy_filename) 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 from PIL import Image, IcnsImagePlugin
@ -121,7 +121,3 @@ class TestFileIcns(PillowTestCase):
with io.BytesIO(b'invalid\n') as fp: with io.BytesIO(b'invalid\n') as fp:
self.assertRaises(SyntaxError, self.assertRaises(SyntaxError,
IcnsImagePlugin.IcnsFile, fp) 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 import io
from PIL import Image, IcoImagePlugin from PIL import Image, IcoImagePlugin
@ -82,7 +82,3 @@ class TestFileIco(PillowTestCase):
self.assertEqual( self.assertEqual(
im_saved.info['sizes'], im_saved.info['sizes'],
{(16, 16), (24, 24), (32, 32), (48, 48)}) {(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 from PIL import Image, ImImagePlugin
@ -69,7 +69,3 @@ class TestFileIm(PillowTestCase):
def test_number(self): def test_number(self):
self.assertEqual(1.2, ImImagePlugin.number("1.2")) 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 from PIL import Image, IptcImagePlugin
@ -69,7 +69,3 @@ class TestFileIptc(PillowTestCase):
# Assert # Assert
self.assertEqual(mystdout.getvalue(), "61 62 63 \n") 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 unittest, PillowTestCase, hopper
from helper import djpeg_available, cjpeg_available from .helper import djpeg_available, cjpeg_available
from io import BytesIO from io import BytesIO
import os import os
@ -581,6 +581,15 @@ class TestFileJpeg(PillowTestCase):
# OSError for unidentified image. # OSError for unidentified image.
self.assertEqual(im.info.get("dpi"), (72, 72)) 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") @unittest.skipUnless(sys.platform.startswith('win32'), "Windows only")
class TestFileCloseW32(PillowTestCase): class TestFileCloseW32(PillowTestCase):
@ -602,7 +611,3 @@ class TestFileCloseW32(PillowTestCase):
self.assertTrue(fp.closed) self.assertTrue(fp.closed)
# this should not fail, as load should have closed the file. # this should not fail, as load should have closed the file.
os.remove(tmpfile) 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 PIL import Image, Jpeg2KImagePlugin
from io import BytesIO from io import BytesIO
@ -210,7 +210,3 @@ class TestFileJpeg2k(PillowTestCase):
# Assert # Assert
self.assertEqual(p.image.size, (640, 480)) self.assertEqual(p.image.size, (640, 480))
if __name__ == '__main__':
unittest.main()

View File

@ -1,5 +1,5 @@
from __future__ import print_function from __future__ import print_function
from helper import unittest, PillowTestCase, hopper from .helper import PillowTestCase, hopper
from PIL import features from PIL import features
from PIL._util import py3 from PIL._util import py3
@ -205,7 +205,7 @@ class TestFileLibTiff(LibTiffTestCase):
# 4: "long", # 4: "long",
# 5: "rational", # 5: "rational",
# 12: "double", # 12: "double",
# type: dummy value # Type: dummy value
values = {2: 'test', values = {2: 'test',
3: 1, 3: 1,
4: 2**20, 4: 2**20,
@ -700,7 +700,3 @@ class TestFileLibTiff(LibTiffTestCase):
im = Image.open(infile) im = Image.open(infile)
self.assert_image_similar_tofile(im, "Tests/images/flower.jpg", 0.5) 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 PIL import Image
from test_file_libtiff import LibTiffTestCase from .test_file_libtiff import LibTiffTestCase
class TestFileLibTiffSmall(LibTiffTestCase): class TestFileLibTiffSmall(LibTiffTestCase):
@ -46,7 +44,3 @@ class TestFileLibTiffSmall(LibTiffTestCase):
self.assertEqual(im.size, (128, 128)) self.assertEqual(im.size, (128, 128))
self._assert_noerr(im) 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 from PIL import Image, McIdasImagePlugin
@ -28,7 +28,3 @@ class TestFileMcIdas(PillowTestCase):
self.assertEqual(im.size, (1800, 400)) self.assertEqual(im.size, (1800, 400))
im2 = Image.open(saved_file) im2 = Image.open(saved_file)
self.assert_image_equal(im, im2) 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 from PIL import Image, ImagePalette, features
@ -64,7 +64,3 @@ class TestFileMic(PillowTestCase):
ole_file = "Tests/images/test-ole-file.doc" ole_file = "Tests/images/test-ole-file.doc"
self.assertRaises(SyntaxError, self.assertRaises(SyntaxError,
MicImagePlugin.MicImageFile, ole_file) 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 io import BytesIO
from PIL import Image from PIL import Image
@ -62,6 +62,14 @@ class TestFileMpo(PillowTestCase):
self.assertEqual(mpinfo[45056], b'0100') self.assertEqual(mpinfo[45056], b'0100')
self.assertEqual(mpinfo[45057], 2) 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): def test_mp_attribute(self):
for test_file in test_files: for test_file in test_files:
im = Image.open(test_file) im = Image.open(test_file)
@ -142,7 +150,3 @@ class TestFileMpo(PillowTestCase):
self.assertEqual(im.tell(), 1) self.assertEqual(im.tell(), 1)
jpg1 = self.frame_roundtrip(im) jpg1 = self.frame_roundtrip(im)
self.assert_image_similar(im, jpg1, 30) 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 from PIL import Image, MspImagePlugin
@ -78,7 +78,3 @@ class TestFileMsp(PillowTestCase):
# Act/Assert # Act/Assert
self.assertRaises(IOError, im.save, filename) 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 import os.path
@ -52,7 +52,3 @@ class TestFilePalm(PillowTestCase):
# Act / Assert # Act / Assert
self.assertRaises(IOError, self.helper_save_as_palm, mode) 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 from PIL import Image
@ -16,7 +16,3 @@ class TestFilePcd(PillowTestCase):
# target = hopper().resize((768,512)) # target = hopper().resize((768,512))
# self.assert_image_similar(im, target, 10) # 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 from PIL import Image, ImageFile, PcxImagePlugin
@ -128,7 +128,3 @@ class TestFilePcx(PillowTestCase):
for x in range(5): for x in range(5):
px[x, 3] = 0 px[x, 3] = 0
self._test_buffer_overflow(im) 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 from PIL import Image, PdfParser
import io import io
import os import os
@ -266,7 +266,3 @@ class TestFilePdf(PillowTestCase):
f = io.BytesIO(f.getvalue()) f = io.BytesIO(f.getvalue())
im.save(f, format="PDF", append=True) im.save(f, format="PDF", append=True)
self.assertGreater(len(f.getvalue()), initial_size) 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 from PIL import Image, PixarImagePlugin
@ -24,7 +24,3 @@ class TestFilePixar(PillowTestCase):
self.assertRaises( self.assertRaises(
SyntaxError, SyntaxError,
PixarImagePlugin.PixarImageFile, invalid_file) 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 import Image, ImageFile, PngImagePlugin
from PIL._util import py3 from PIL._util import py3
@ -596,6 +596,7 @@ class TestFilePng(PillowTestCase):
im = Image.open("Tests/images/iss634.apng") im = Image.open("Tests/images/iss634.apng")
self.assertEqual(im.get_format_mimetype(), 'image/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") expected = Image.open("Tests/images/iss634.webp")
self.assert_image_similar(im, expected, 0.23) self.assert_image_similar(im, expected, 0.23)
@ -625,7 +626,3 @@ class TestTruncatedPngPLeaks(PillowLeakTestCase):
self._test_leak(core) self._test_leak(core)
finally: finally:
ImageFile.LOAD_TRUNCATED_IMAGES = False 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 from PIL import Image
@ -49,7 +49,3 @@ class TestFilePpm(PillowTestCase):
with self.assertRaises(IOError): with self.assertRaises(IOError):
Image.open('Tests/images/negative_size.ppm') 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 from PIL import Image, PsdImagePlugin
@ -76,7 +76,3 @@ class TestImagePsd(PillowTestCase):
im = Image.open("Tests/images/hopper_merged.psd") im = Image.open("Tests/images/hopper_merged.psd")
self.assertNotIn("icc_profile", im.info) 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 from PIL import Image, SgiImagePlugin
@ -89,7 +89,3 @@ class TestFileSgi(PillowTestCase):
out = self.tempfile('temp.sgi') out = self.tempfile('temp.sgi')
self.assertRaises(ValueError, im.save, out, format='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 Image
from PIL import ImageSequence from PIL import ImageSequence
@ -119,7 +119,3 @@ class TestImageSpider(PillowTestCase):
for i, frame in enumerate(ImageSequence.Iterator(im)): for i, frame in enumerate(ImageSequence.Iterator(im)):
if i > 1: if i > 1:
self.fail("Non-stack DOS file test failed") 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 from PIL import Image, SunImagePlugin
@ -45,7 +45,3 @@ class TestFileSun(PillowTestCase):
# im.save(target_file) # im.save(target_file)
with Image.open(target_path) as target: with Image.open(target_path) as target:
self.assert_image_equal(im, 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 from PIL import Image, TarIO
@ -34,7 +34,3 @@ class TestFileTar(PillowTestCase):
def test_contextmanager(self): def test_contextmanager(self):
with TarIO.TarIO(TEST_TAR_FILE, 'hopper.jpg'): with TarIO.TarIO(TEST_TAR_FILE, 'hopper.jpg'):
pass pass
if __name__ == '__main__':
unittest.main()

View File

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

View File

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

View File

@ -1,7 +1,7 @@
import io import io
import struct import struct
from helper import unittest, PillowTestCase, hopper from .helper import PillowTestCase, hopper
from PIL import Image, TiffImagePlugin, TiffTags from PIL import Image, TiffImagePlugin, TiffTags
from PIL.TiffImagePlugin import _limit_rational, IFDRational from PIL.TiffImagePlugin import _limit_rational, IFDRational
@ -247,7 +247,3 @@ class TestFileTiffMetadata(PillowTestCase):
# Should not raise ValueError. # Should not raise ValueError.
self.assert_warning(UserWarning, lambda: ifd[277]) 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 from PIL import WalImageFile
@ -17,7 +17,3 @@ class TestFileWal(PillowTestCase):
self.assertEqual(im.format_description, "Quake2 Texture") self.assertEqual(im.format_description, "Quake2 Texture")
self.assertEqual(im.mode, "P") self.assertEqual(im.mode, "P")
self.assertEqual(im.size, (128, 128)) 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 from PIL import Image, WebPImagePlugin
@ -172,7 +172,3 @@ class TestFileWebp(PillowTestCase):
difference = sum([abs(original_value[i] - reread_value[i]) difference = sum([abs(original_value[i] - reread_value[i])
for i in range(0, 3)]) for i in range(0, 3)])
self.assertLess(difference, 5) 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 from PIL import Image
@ -115,7 +115,3 @@ class TestFileWebpAlpha(PillowTestCase):
target = Image.open(file_path).convert("RGBA") target = Image.open(file_path).convert("RGBA")
self.assert_image_similar(image, target, 25.0) 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 from PIL import Image
@ -151,7 +151,3 @@ class TestFileWebpAnimation(PillowTestCase):
self.assertEqual(im.info["duration"], dur) self.assertEqual(im.info["duration"], dur)
self.assertEqual(im.info["timestamp"], ts) self.assertEqual(im.info["timestamp"], ts)
ts -= dur 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 from PIL import Image
@ -36,7 +36,3 @@ class TestFileWebpLossless(PillowTestCase):
image.getdata() image.getdata()
self.assert_image_equal(image, hopper(self.rgb_mode)) 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 from PIL import Image
@ -133,7 +133,3 @@ class TestFileWebpMetadata(PillowTestCase):
self.assertEqual(iccp_data, image.info.get('icc_profile', None)) self.assertEqual(iccp_data, image.info.get('icc_profile', None))
self.assertEqual(exif_data, image.info.get('exif', None)) self.assertEqual(exif_data, image.info.get('exif', None))
self.assertEqual(xmp_data, image.info.get('xmp', 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 Image
from PIL import WmfImagePlugin from PIL import WmfImagePlugin
@ -51,7 +51,3 @@ class TestFileWmf(PillowTestCase):
for ext in [".wmf", ".emf"]: for ext in [".wmf", ".emf"]:
tmpfile = self.tempfile("temp"+ext) tmpfile = self.tempfile("temp"+ext)
self.assertRaises(IOError, im.save, tmpfile) 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 from PIL import Image
@ -60,7 +60,3 @@ class TestFileXbm(PillowTestCase):
# Assert # Assert
self.assertEqual(im.mode, '1') self.assertEqual(im.mode, '1')
self.assertEqual(im.size, (128, 128)) 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 from PIL import Image, XpmImagePlugin
@ -33,7 +33,3 @@ class TestFileXpm(PillowTestCase):
# Assert # Assert
self.assertEqual(len(data), 16384) 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 from PIL import Image, XVThumbImagePlugin
@ -34,7 +34,3 @@ class TestFileXVThumb(PillowTestCase):
# Act / Assert # Act / Assert
self.assertRaises(SyntaxError, self.assertRaises(SyntaxError,
XVThumbImagePlugin.XVThumbImageFile, invalid_file) 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 from PIL import FontFile, BdfFontFile
@ -18,7 +18,3 @@ class TestFontBdf(PillowTestCase):
def test_invalid_file(self): def test_invalid_file(self):
with open("Tests/images/flower.jpg", "rb") as fp: with open("Tests/images/flower.jpg", "rb") as fp:
self.assertRaises(SyntaxError, BdfFontFile.BdfFontFile, fp) self.assertRaises(SyntaxError, BdfFontFile.BdfFontFile, fp)
if __name__ == '__main__':
unittest.main()

View File

@ -1,5 +1,5 @@
from __future__ import division from __future__ import division
from helper import unittest, PillowLeakTestCase from .helper import unittest, PillowLeakTestCase
import sys import sys
from PIL import Image, features, ImageDraw, ImageFont from PIL import Image, features, ImageDraw, ImageFont
@ -31,7 +31,3 @@ class TestDefaultFontLeak(TestTTypeFontLeak):
def test_leak(self): def test_leak(self):
default_font = ImageFont.load_default() default_font = ImageFont.load_default()
self._test_font(default_font) 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 Image, FontFile, PcfFontFile
from PIL import ImageFont, ImageDraw from PIL import ImageFont, ImageDraw
@ -79,7 +79,3 @@ class TestFontPcf(PillowTestCase):
# accept bytes instances in Py3. # accept bytes instances in Py3.
if py3: if py3:
self._test_high_characters(message.encode('latin1')) 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 import Image
from PIL._util import py3 from PIL._util import py3
@ -129,7 +129,3 @@ class TestFormatHSV(PillowTestCase):
self.assert_image_similar(converted.getchannel(2), self.assert_image_similar(converted.getchannel(2),
comparable.getchannel(2), comparable.getchannel(2),
3, "B conversion is wrong") 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 from PIL import Image
@ -40,7 +40,3 @@ class TestFormatLab(PillowTestCase):
k = i.getpixel((0, 0)) k = i.getpixel((0, 0))
self.assertEqual(k, (128, 228, 128)) 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 import Image
from PIL._util import py3 from PIL._util import py3
@ -560,7 +560,3 @@ class TestRegistry(PillowTestCase):
'DoesNotExist', 'DoesNotExist',
('args',), ('args',),
extra=('extra',)) 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 from PIL import Image
import sys import sys
@ -366,7 +366,3 @@ int main(int argc, char* argv[])
process = subprocess.Popen(['embed_pil.exe'], env=env) process = subprocess.Popen(['embed_pil.exe'], env=env)
process.communicate() process.communicate()
self.assertEqual(process.returncode, 0) 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 from PIL import Image
@ -55,7 +55,3 @@ class TestImageArray(PillowTestCase):
self.assertEqual(test("RGB"), ("RGB", (128, 100), True)) self.assertEqual(test("RGB"), ("RGB", (128, 100), True))
self.assertEqual(test("RGBA"), ("RGBA", (128, 100), True)) self.assertEqual(test("RGBA"), ("RGBA", (128, 100), True))
self.assertEqual(test("RGBX"), ("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 from PIL import Image
@ -230,7 +230,3 @@ class TestImageConvert(PillowTestCase):
# Assert # Assert
# No change # No change
self.assert_image_equal(converted_im, im) 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 from PIL import Image
@ -40,7 +40,3 @@ class TestImageCopy(PillowTestCase):
out = im.copy() out = im.copy()
self.assertEqual(out.mode, im.mode) self.assertEqual(out.mode, im.mode)
self.assertEqual(out.size, im.size) 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 from PIL import Image
@ -102,7 +102,3 @@ class TestImageCrop(PillowTestCase):
cropped = im.crop((10, 10, 20, 20)) cropped = im.crop((10, 10, 20, 20))
self.assertEqual(cropped.size, (10, 10)) self.assertEqual(cropped.size, (10, 10))
self.assertEqual(cropped.getdata()[2], (0, 0, 0)) 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 from PIL import Image
@ -69,7 +69,3 @@ class TestImageDraft(PillowTestCase):
im = self.draft_roundtrip('L', (128, 128), None, (64, 64)) im = self.draft_roundtrip('L', (128, 128), None, (64, 64))
im.draft(None, (64, 64)) im.draft(None, (64, 64))
im.load() 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 from PIL import Image, ImageFilter
@ -136,7 +136,3 @@ class TestImageFilter(PillowTestCase):
Image.merge(mode, source[:len(mode)]).filter(kernel), Image.merge(mode, source[:len(mode)]).filter(kernel),
Image.merge(mode, reference[:len(mode)]), 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 from PIL import Image
@ -13,7 +13,3 @@ class TestImageFromBytes(PillowTestCase):
def test_not_implemented(self): def test_not_implemented(self):
self.assertRaises(NotImplementedError, Image.fromstring) self.assertRaises(NotImplementedError, Image.fromstring)
if __name__ == '__main__':
unittest.main()

View File

@ -1,5 +1,5 @@
from helper import unittest, PillowTestCase, hopper from .helper import PillowTestCase, hopper
from test_imageqt import PillowQtTestCase from .test_imageqt import PillowQtTestCase
from PIL import ImageQt, Image from PIL import ImageQt, Image
@ -42,7 +42,3 @@ class TestFromQImage(PillowQtTestCase, PillowTestCase):
def test_sanity_p(self): def test_sanity_p(self):
for im in self.files_to_test: for im in self.files_to_test:
self.roundtrip(im.convert('P')) 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 from PIL import Image
@ -18,7 +18,3 @@ class TestImageGetBands(PillowTestCase):
Image.new("CMYK", (1, 1)).getbands(), ("C", "M", "Y", "K")) Image.new("CMYK", (1, 1)).getbands(), ("C", "M", "Y", "K"))
self.assertEqual( self.assertEqual(
Image.new("YCbCr", (1, 1)).getbands(), ("Y", "Cb", "Cr")) 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 from PIL import Image
@ -37,7 +37,3 @@ class TestImageGetBbox(PillowTestCase):
im.paste(255, (-10, -10, 110, 110)) im.paste(255, (-10, -10, 110, 110))
self.assertEqual(im.getbbox(), (0, 0, 100, 100)) 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): class TestImageGetColors(PillowTestCase):
@ -65,7 +65,3 @@ class TestImageGetColors(PillowTestCase):
A = im.getcolors(maxcolors=16) A = im.getcolors(maxcolors=16)
A.sort() A.sort()
self.assertEqual(A, expected) 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): class TestImageGetData(PillowTestCase):
@ -27,7 +27,3 @@ class TestImageGetData(PillowTestCase):
self.assertEqual(getdata("RGBA"), ((11, 13, 52, 255), 960, 960)) self.assertEqual(getdata("RGBA"), ((11, 13, 52, 255), 960, 960))
self.assertEqual(getdata("CMYK"), ((244, 242, 203, 0), 960, 960)) self.assertEqual(getdata("CMYK"), ((244, 242, 203, 0), 960, 960))
self.assertEqual(getdata("YCbCr"), ((16, 147, 123), 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