Merge branch 'mime-types' of https://github.com/pirate486743186/Pillow into mime-types

This commit is contained in:
pirate486743186 2019-03-04 14:54:09 +01:00
commit 44659faaed
257 changed files with 1147 additions and 1277 deletions

View File

@ -25,8 +25,6 @@ environment:
- PYTHON: C:/Python36-x64 - PYTHON: C:/Python36-x64
- PYTHON: C:/Python35 - PYTHON: C:/Python35
- PYTHON: C:/Python35-x64 - PYTHON: C:/Python35-x64
- PYTHON: C:/Python34
- PYTHON: C:/Python34-x64
- PYTHON: C:/msys64/mingw32 - PYTHON: C:/msys64/mingw32
EXECUTABLE: bin/python3 EXECUTABLE: bin/python3
PIP_DIR: bin PIP_DIR: bin

3
.gitignore vendored
View File

@ -56,6 +56,9 @@ test_images
# Sphinx documentation # Sphinx documentation
docs/_build/ docs/_build/
# viewdoc output
.long-description.html
# Vim cruft # Vim cruft
.*.swp .*.swp

View File

@ -31,6 +31,7 @@ matrix:
dist: trusty dist: trusty
- python: "2.7_with_system_site_packages" # For PyQt4 - python: "2.7_with_system_site_packages" # For PyQt4
name: "2.7_with_system_site_packages Xenial" name: "2.7_with_system_site_packages Xenial"
services: xvfb
- python: "2.7_with_system_site_packages" # For PyQt4 - python: "2.7_with_system_site_packages" # For PyQt4
name: "2.7_with_system_site_packages Trusty" name: "2.7_with_system_site_packages Trusty"
dist: trusty dist: trusty
@ -46,44 +47,46 @@ 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.4' - python: "3.8-dev"
name: "3.4 Trusty" name: "3.8-dev Xenial"
dist: trusty - env: DOCKER="alpine" DOCKER_TAG="master"
- env: DOCKER="alpine" DOCKER_TAG="pytest" - env: DOCKER="arch" DOCKER_TAG="master" # contains PyQt5
- env: DOCKER="arch" DOCKER_TAG="pytest" # contains PyQt5 - env: DOCKER="ubuntu-trusty-x86" DOCKER_TAG="master"
- env: DOCKER="ubuntu-trusty-x86" DOCKER_TAG="pytest" - env: DOCKER="ubuntu-xenial-amd64" DOCKER_TAG="master"
- env: DOCKER="ubuntu-xenial-amd64" DOCKER_TAG="pytest" - env: DOCKER="debian-stretch-x86" DOCKER_TAG="master"
- env: DOCKER="debian-stretch-x86" DOCKER_TAG="pytest" - env: DOCKER="centos-6-amd64" DOCKER_TAG="master"
- env: DOCKER="centos-6-amd64" DOCKER_TAG="pytest" - env: DOCKER="centos-7-amd64" DOCKER_TAG="master"
- env: DOCKER="centos-7-amd64" DOCKER_TAG="pytest" - env: DOCKER="amazon-1-amd64" DOCKER_TAG="master"
- env: DOCKER="amazon-1-amd64" DOCKER_TAG="pytest" - env: DOCKER="amazon-2-amd64" DOCKER_TAG="master"
- env: DOCKER="amazon-2-amd64" DOCKER_TAG="pytest"
- env: DOCKER="fedora-28-amd64" DOCKER_TAG="master" - env: DOCKER="fedora-28-amd64" DOCKER_TAG="master"
- env: DOCKER="fedora-29-amd64" DOCKER_TAG="master" - env: DOCKER="fedora-29-amd64" DOCKER_TAG="master"
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
pip install -U flake8 pip install tox
elif [ "$DOCKER" == "" ]; then elif [ "$DOCKER" == "" ]; then
.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
- "export DISPLAY=:99.0" - |
- "sh -e /etc/init.d/xvfb start" if [ "$TRAVIS_JOB_NAME" == "2.7_with_system_site_packages Trusty" ]; then
export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start
fi
script: script:
- | - |
if [ "$LINT" == "true" ]; then if [ "$LINT" == "true" ]; then
flake8 --statistics --count tox -e lint
elif [ "$DOCKER" == "" ]; then elif [ "$DOCKER" == "" ]; then
.travis/script.sh .travis/script.sh
elif [ "$DOCKER" ]; then elif [ "$DOCKER" ]; then

View File

@ -2,9 +2,108 @@
Changelog (Pillow) Changelog (Pillow)
================== ==================
5.4.0 (unreleased) 6.0.0 (unreleased)
------------------ ------------------
- Python 2.7 support will be removed in Pillow 7.0.0 #3682
[hugovk]
- Removed deprecated VERSION #3624
[hugovk]
- Fix 'BytesWarning: Comparison between bytes and string' in PdfDict #3580
[jdufresne]
- Do not resize in Image.thumbnail if already the destination size #3632
[radarhere]
- Replace .seek() magic numbers with io.SEEK_* constants #3572
[jdufresne]
- Make ContainerIO.isatty() return a bool, not int #3568
[jdufresne]
- Add support for I;16 modes for more transpose operations #3563
[radarhere]
- Deprecate support for PyQt4 and PySide #3655
[hugovk, radarhere]
- Add TIFF compression codecs: LZMA, Zstd, WebP #3555
[cgohlke]
- Fixed pickling of iTXt class with protocol > 1 #3537
[radarhere]
- _util.isPath returns True for pathlib.Path objects #3616
[wbadart]
- 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]
- Remove deprecated PIL.OleFileIO #3598
[hugovk]
- Remove deprecated ImageOps undocumented functions #3599
[hugovk]
- Depends: Update libwebp to 1.0.2 #3602
[radarhere]
- Detect MIME types #3525
[radarhere]
5.4.1 (2019-01-06)
------------------
- File closing: Only close __fp if not fp #3540
[radarhere]
- Fix build for Termux #3529
[pslacerda]
- PNG: Detect MIME types #3525
[radarhere]
- PNG: Handle IDAT chunks after image end #3532
[radarhere]
5.4.0 (2019-01-01)
------------------
- Docs: Improved ImageChops documentation #3522
[radarhere]
- Allow RGB and RGBA values for P image putpixel #3519
[radarhere]
- Add APNG extension to PNG plugin #3501 - Add APNG extension to PNG plugin #3501
[pirate486743186, radarhere] [pirate486743186, radarhere]

View File

@ -5,7 +5,7 @@ The Python Imaging Library (PIL) is
Pillow is the friendly PIL fork. It is Pillow is the friendly PIL fork. It is
Copyright © 2010-2018 by Alex Clark and contributors Copyright © 2010-2019 by Alex Clark and contributors
Like PIL, Pillow is licensed under the open source PIL Software License: Like PIL, Pillow is licensed under the open source PIL Software License:

View File

@ -22,6 +22,7 @@ exclude .coveragerc
exclude .codecov.yml exclude .codecov.yml
exclude .editorconfig exclude .editorconfig
exclude .landscape.yaml exclude .landscape.yaml
exclude .readthedocs.yml
exclude .travis exclude .travis
exclude .travis/* exclude .travis/*
exclude tox.ini exclude tox.ini

View File

@ -5,52 +5,52 @@
Released quarterly on the first day of January, April, July, October. Released quarterly on the first day of January, April, July, October.
* [ ] Open a release ticket e.g. https://github.com/python-pillow/Pillow/issues/3154 * [ ] Open a release ticket e.g. https://github.com/python-pillow/Pillow/issues/3154
* [ ] Develop and prepare release in ``master`` branch. * [ ] Develop and prepare release in `master` branch.
* [ ] Check [Travis CI](https://travis-ci.org/python-pillow/Pillow) and [AppVeyor CI](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm passing tests in ``master`` branch. * [ ] Check [Travis CI](https://travis-ci.org/python-pillow/Pillow) and [AppVeyor CI](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm passing tests in `master` branch.
* [ ] Check that all of the wheel builds [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels) pass the tests in Travis CI. * [ ] Check that all of the wheel builds [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels) pass the tests in Travis CI.
* [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), update version identifier in `src/PIL/_version.py` * [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), update version identifier in `src/PIL/_version.py`
* [ ] Update `CHANGES.rst`. * [ ] Update `CHANGES.rst`.
* [ ] Run pre-release check via `make release-test` in a freshly cloned repo. * [ ] Run pre-release check via `make release-test` in a freshly cloned repo.
* [ ] Create branch and tag for release e.g.: * [ ] Create branch and tag for release e.g.:
``` ```bash
$ git branch 5.2.x git branch 5.2.x
$ git tag 5.2.0 git tag 5.2.0
$ git push --all git push --all
$ git push --tags git push --tags
``` ```
* [ ] Create source distributions e.g.: * [ ] Create source distributions e.g.:
``` ```bash
$ make sdist make sdist
``` ```
* [ ] Create [binary distributions](#binary-distributions) * [ ] Create [binary distributions](https://github.com/python-pillow/Pillow/blob/master/RELEASING.md#binary-distributions)
* [ ] Upload all binaries and source distributions e.g. ``twine upload dist/Pillow-5.2.0-*`` * [ ] Upload all binaries and source distributions e.g. `twine upload dist/Pillow-5.2.0*`
* [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new) * [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new)
* [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), append `.dev0` to version identifier in `src/PIL/_version.py` * [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), increment and append `.dev0` to version identifier in `src/PIL/_version.py`
## Point Release ## Point Release
Released as needed for security, installation or critical bug fixes. Released as needed for security, installation or critical bug fixes.
* [ ] Make necessary changes in ``master`` branch. * [ ] Make necessary changes in `master` branch.
* [ ] Update `CHANGES.rst`. * [ ] Update `CHANGES.rst`.
* [ ] Cherry pick individual commits from ``master`` branch to release branch e.g. ``5.2.x``.
* [ ] Check [Travis CI](https://travis-ci.org/python-pillow/Pillow) to confirm passing tests in release branch e.g. ``5.2.x``.
* [ ] Check out release branch e.g.: * [ ] Check out release branch e.g.:
``` ```bash
git checkout -t remotes/origin/5.2.x git checkout -t remotes/origin/5.2.x
``` ```
* [ ] Cherry pick individual commits from `master` branch to release branch e.g. `5.2.x`.
* [ ] Check [Travis CI](https://travis-ci.org/python-pillow/Pillow) to confirm passing tests in release branch e.g. `5.2.x`.
* [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), update version identifier in `src/PIL/_version.py` * [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), update version identifier in `src/PIL/_version.py`
* [ ] Run pre-release check via `make release-test`. * [ ] Run pre-release check via `make release-test`.
* [ ] Create tag for release e.g.: * [ ] Create tag for release e.g.:
``` ```bash
$ git tag 5.2.1 git tag 5.2.1
$ git push --tags git push --tags
``` ```
* [ ] Create source distributions e.g.: * [ ] Create source distributions e.g.:
``` ```bash
$ make sdist make sdist
``` ```
* [ ] Create [binary distributions](#binary-distributions) * [ ] Create [binary distributions](https://github.com/python-pillow/Pillow/blob/master/RELEASING.md#binary-distributions)
* [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new) * [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new)
## Embargoed Release ## Embargoed Release
@ -64,41 +64,37 @@ Released as needed privately to individual vendors for critical security-related
* [ ] Run pre-release check via `make release-test` * [ ] Run pre-release check via `make release-test`
* [ ] Amend any commits with the CVE # * [ ] Amend any commits with the CVE #
* [ ] On release date, tag and push to GitHub. * [ ] On release date, tag and push to GitHub.
``` ```bash
git checkout 2.5.x git checkout 2.5.x
git tag 2.5.3 git tag 2.5.3
git push origin 2.5.x git push origin 2.5.x
git push origin --tags git push origin --tags
``` ```
* [ ] Create source distributions e.g.: * [ ] Create source distributions e.g.:
``` ```bash
$ make sdist make sdist
``` ```
* [ ] Create [binary distributions](#binary-distributions) * [ ] Create [binary distributions](https://github.com/python-pillow/Pillow/blob/master/RELEASING.md#binary-distributions)
* [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new) * [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new)
## Binary Distributions ## Binary Distributions
### Windows ### Windows
* [ ] Contact @cgohlke for Windows binaries via release ticket e.g. https://github.com/python-pillow/Pillow/issues/1174. * [ ] Contact `@cgohlke` for Windows binaries via release ticket e.g. https://github.com/python-pillow/Pillow/issues/1174.
* [ ] Download and extract tarball from @cgohlke and ``twine upload *``. * [ ] Download and extract tarball from `@cgohlke` and `twine upload *`.
### Mac and Linux ### Mac and Linux
* [ ] Use the [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels): * [ ] Use the [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels):
``` ```bash
$ git clone https://github.com/python-pillow/pillow-wheels git clone https://github.com/python-pillow/pillow-wheels
$ cd pillow-wheels cd pillow-wheels
$ git submodule init ./update-pillow-tag.sh [[release tag]]
$ git submodule update Pillow ```
$ cd Pillow
$ git fetch --all
$ git checkout [[release tag]]
$ cd ..
$ git commit -m "Pillow -> 5.2.0" Pillow
$ git push
```
* [ ] Download distributions from the [Pillow Wheel Builder container](http://a365fff413fe338398b6-1c8a9b3114517dc5fe17b7c3f8c63a43.r19.cf2.rackcdn.com/). * [ ] Download distributions from the [Pillow Wheel Builder container](http://a365fff413fe338398b6-1c8a9b3114517dc5fe17b7c3f8c63a43.r19.cf2.rackcdn.com/).
```bash
wget -m -A 'Pillow-<VERSION>*' \
http://a365fff413fe338398b6-1c8a9b3114517dc5fe17b7c3f8c63a43.r19.cf2.rackcdn.com
```
## Publicize Release ## Publicize Release
@ -106,4 +102,4 @@ Released as needed privately to individual vendors for critical security-related
## Documentation ## Documentation
* [ ] Make sure the default version for Read the Docs is the latest release version, i.e. ``5.2.0`` rather than ``latest`` e.g. https://pillow.readthedocs.io/en/5.2.x/ * [ ] Make sure the default version for Read the Docs is the latest tagged release e.g. `d2d43879` (5.4.0)

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

View File

@ -53,10 +53,6 @@ class PillowTestCase(unittest.TestCase):
# holds last result object passed to run method: # holds last result object passed to run method:
self.currentResult = None self.currentResult = None
# Nicer output for --verbose
def __str__(self):
return self.__class__.__name__ + "." + self._testMethodName
def run(self, result=None): def run(self, result=None):
self.currentResult = result # remember result for use later self.currentResult = result # remember result for use later
unittest.TestCase.run(self, result) # call superclass run method unittest.TestCase.run(self, result) # call superclass run method

BIN
Tests/images/balloon.jpf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
Tests/images/hopper.pnm Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 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
@ -11,8 +11,6 @@ class TestSanity(PillowTestCase):
# Make sure we have the binary extension # Make sure we have the binary extension
PIL.Image.core.new("L", (100, 100)) PIL.Image.core.new("L", (100, 100))
self.assertEqual(PIL.Image.VERSION[:3], '1.1')
# Create an image and do stuff with it. # Create an image and do stuff with it.
im = PIL.Image.new("1", (100, 100)) im = PIL.Image.new("1", (100, 100))
self.assertEqual((im.mode, im.size), ('1', (100, 100))) self.assertEqual((im.mode, im.size), ('1', (100, 100)))
@ -24,7 +22,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
@ -16,7 +16,7 @@ class TestFileContainer(PillowTestCase):
im = hopper() im = hopper()
container = ContainerIO.ContainerIO(im, 0, 0) container = ContainerIO.ContainerIO(im, 0, 0)
self.assertEqual(container.isatty(), 0) self.assertFalse(container.isatty())
def test_seek_mode_0(self): def test_seek_mode_0(self):
# Arrange # Arrange
@ -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
@ -14,6 +14,7 @@ class TestFileIco(PillowTestCase):
self.assertEqual(im.mode, "RGBA") self.assertEqual(im.mode, "RGBA")
self.assertEqual(im.size, (16, 16)) self.assertEqual(im.size, (16, 16))
self.assertEqual(im.format, "ICO") self.assertEqual(im.format, "ICO")
self.assertEqual(im.get_format_mimetype(), "image/x-icon")
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:
@ -82,7 +83,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
@ -39,6 +39,12 @@ class TestFileJpeg2k(PillowTestCase):
self.assertEqual(im.mode, 'RGB') self.assertEqual(im.mode, 'RGB')
self.assertEqual(im.size, (640, 480)) self.assertEqual(im.size, (640, 480))
self.assertEqual(im.format, 'JPEG2000') self.assertEqual(im.format, 'JPEG2000')
self.assertEqual(im.get_format_mimetype(), 'image/jp2')
def test_jpf(self):
im = Image.open('Tests/images/balloon.jpf')
self.assertEqual(im.format, 'JPEG2000')
self.assertEqual(im.get_format_mimetype(), 'image/jpx')
def test_invalid_file(self): def test_invalid_file(self):
invalid_file = "Tests/images/flower.jpg" invalid_file = "Tests/images/flower.jpg"
@ -204,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
@ -195,7 +195,7 @@ class TestFileLibTiff(LibTiffTestCase):
im = Image.open('Tests/images/hopper_g4.tif') im = Image.open('Tests/images/hopper_g4.tif')
for tag in im.tag_v2: for tag in im.tag_v2:
try: try:
del(core_items[tag]) del core_items[tag]
except KeyError: except KeyError:
pass pass
@ -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,
@ -223,7 +223,7 @@ class TestFileLibTiff(LibTiffTestCase):
for _ in range(info.length)) for _ in range(info.length))
# Extra samples really doesn't make sense in this application. # Extra samples really doesn't make sense in this application.
del(new_ifd[338]) del new_ifd[338]
out = self.tempfile("temp.tif") out = self.tempfile("temp.tif")
TiffImagePlugin.WRITE_LIBTIFF = True TiffImagePlugin.WRITE_LIBTIFF = True
@ -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
@ -12,11 +12,11 @@ YA_EXTRA_DIR = "Tests/images/msp"
class TestFileMsp(PillowTestCase): class TestFileMsp(PillowTestCase):
def test_sanity(self): def test_sanity(self):
file = self.tempfile("temp.msp") test_file = self.tempfile("temp.msp")
hopper("1").save(file) hopper("1").save(test_file)
im = Image.open(file) im = Image.open(test_file)
im.load() im.load()
self.assertEqual(im.mode, "1") self.assertEqual(im.mode, "1")
self.assertEqual(im.size, (128, 128)) self.assertEqual(im.size, (128, 128))
@ -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
@ -13,6 +13,7 @@ class TestFilePcx(PillowTestCase):
self.assertEqual(im2.mode, im.mode) self.assertEqual(im2.mode, im.mode)
self.assertEqual(im2.size, im.size) self.assertEqual(im2.size, im.size)
self.assertEqual(im2.format, "PCX") self.assertEqual(im2.format, "PCX")
self.assertEqual(im2.get_format_mimetype(), "image/x-pcx")
self.assert_image_equal(im2, im) self.assert_image_equal(im2, im)
def test_sanity(self): def test_sanity(self):
@ -128,7 +129,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
@ -86,6 +86,7 @@ class TestFilePng(PillowTestCase):
self.assertEqual(im.mode, "RGB") self.assertEqual(im.mode, "RGB")
self.assertEqual(im.size, (128, 128)) self.assertEqual(im.size, (128, 128))
self.assertEqual(im.format, "PNG") self.assertEqual(im.format, "PNG")
self.assertEqual(im.get_format_mimetype(), 'image/png')
hopper("1").save(test_file) hopper("1").save(test_file)
Image.open(test_file) Image.open(test_file)
@ -585,10 +586,17 @@ class TestFilePng(PillowTestCase):
self.assertIsInstance(im.text, dict) self.assertIsInstance(im.text, dict)
ImageFile.LOAD_TRUNCATED_IMAGES = False ImageFile.LOAD_TRUNCATED_IMAGES = False
# Raises an EOFError in load_end
im = Image.open("Tests/images/hopper_idat_after_image_end.png")
self.assertEqual(im.text, {'TXT': 'VALUE', 'ZIP': 'VALUE'})
@unittest.skipUnless(HAVE_WEBP and _webp.HAVE_WEBPANIM, @unittest.skipUnless(HAVE_WEBP and _webp.HAVE_WEBPANIM,
"WebP support not installed with animation") "WebP support not installed with animation")
def test_apng(self): def test_apng(self):
im = Image.open("Tests/images/iss634.apng") 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") expected = Image.open("Tests/images/iss634.webp")
self.assert_image_similar(im, expected, 0.23) self.assert_image_similar(im, expected, 0.23)
@ -618,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, hopper
from PIL import Image from PIL import Image
@ -34,6 +34,16 @@ class TestFilePpm(PillowTestCase):
reloaded = Image.open(f) reloaded = Image.open(f)
self.assert_image_equal(im, reloaded) self.assert_image_equal(im, reloaded)
def test_pnm(self):
im = Image.open('Tests/images/hopper.pnm')
self.assert_image_similar(im, hopper(), 0.0001)
f = self.tempfile('temp.pnm')
im.save(f)
reloaded = Image.open(f)
self.assert_image_equal(im, reloaded)
def test_truncated_file(self): def test_truncated_file(self):
path = self.tempfile('temp.pgm') path = self.tempfile('temp.pgm')
with open(path, 'w') as f: with open(path, 'w') as f:
@ -49,7 +59,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
@ -12,6 +12,7 @@ class TestFileSgi(PillowTestCase):
im = Image.open(test_file) im = Image.open(test_file)
self.assert_image_equal(im, hopper()) self.assert_image_equal(im, hopper())
self.assertEqual(im.get_format_mimetype(), 'image/rgb')
def test_rgb16(self): def test_rgb16(self):
test_file = "Tests/images/hopper16.rgb" test_file = "Tests/images/hopper16.rgb"
@ -26,6 +27,7 @@ class TestFileSgi(PillowTestCase):
im = Image.open(test_file) im = Image.open(test_file)
self.assert_image_similar(im, hopper('L'), 2) self.assert_image_similar(im, hopper('L'), 2)
self.assertEqual(im.get_format_mimetype(), 'image/sgi')
def test_rgba(self): def test_rgba(self):
# Created with ImageMagick: # Created with ImageMagick:
@ -35,6 +37,7 @@ class TestFileSgi(PillowTestCase):
im = Image.open(test_file) im = Image.open(test_file)
target = Image.open('Tests/images/transparent.png') target = Image.open('Tests/images/transparent.png')
self.assert_image_equal(im, target) self.assert_image_equal(im, target)
self.assertEqual(im.get_format_mimetype(), 'image/sgi')
def test_rle(self): def test_rle(self):
# Created with ImageMagick: # Created with ImageMagick:
@ -86,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
@ -37,6 +37,8 @@ class TestFileTga(PillowTestCase):
path_no_ext, origin, "rle" if rle else "raw") path_no_ext, origin, "rle" if rle else "raw")
original_im = Image.open(tga_path) original_im = Image.open(tga_path)
self.assertEqual(original_im.format, "TGA")
self.assertEqual(original_im.get_format_mimetype(), "image/x-tga")
if rle: if rle:
self.assertEqual( self.assertEqual(
original_im.info["compression"], "tga_rle") original_im.info["compression"], "tga_rle")
@ -201,7 +203,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
@ -220,6 +220,10 @@ class TestFileTiff(PillowTestCase):
self.assertEqual( self.assertEqual(
im.getextrema(), (-3.140936851501465, 3.140684127807617)) im.getextrema(), (-3.140936851501465, 3.140684127807617))
def test_unknown_pixel_mode(self):
self.assertRaises(
IOError, Image.open, 'Tests/images/hopper_unknown_pixel_mode.tif')
def test_n_frames(self): def test_n_frames(self):
for path, n_frames in [ for path, n_frames in [
['Tests/images/multipage-lastframe.tif', 1], ['Tests/images/multipage-lastframe.tif', 1],
@ -561,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
@ -175,6 +175,12 @@ class TestImageGetPixel(AccessTest):
self.check(mode, 2**15+1) self.check(mode, 2**15+1)
self.check(mode, 2**16-1) self.check(mode, 2**16-1)
def test_p_putpixel_rgb_rgba(self):
for color in [(255, 0, 0), (255, 0, 0, 255)]:
im = Image.new("P", (1, 1), 0)
im.putpixel((0, 0), color)
self.assertEqual(im.convert("RGB").getpixel((0, 0)), (255, 0, 0))
@unittest.skipIf(cffi is None, "No cffi") @unittest.skipIf(cffi is None, "No cffi")
class TestCffiPutPixel(TestImagePutPixel): class TestCffiPutPixel(TestImagePutPixel):
@ -294,13 +300,18 @@ class TestCffi(AccessTest):
# pixels can contain garbage if image is released # pixels can contain garbage if image is released
self.assertEqual(px[i, 0], 0) self.assertEqual(px[i, 0], 0)
def test_p_putpixel_rgb_rgba(self):
for color in [(255, 0, 0), (255, 0, 0, 255)]:
im = Image.new("P", (1, 1), 0)
access = PyAccess.new(im, False)
access.putpixel((0, 0), color)
self.assertEqual(im.convert("RGB").getpixel((0, 0)), (255, 0, 0))
class TestEmbeddable(unittest.TestCase): class TestEmbeddable(unittest.TestCase):
@unittest.skipIf(not sys.platform.startswith('win32') or @unittest.skipIf(not sys.platform.startswith('win32') or
sys.version_info[:2] == (3, 4) or on_appveyor(),
on_appveyor(), # failing on appveyor when run from "Failing on AppVeyor when run from subprocess, not from shell")
# subprocess, not from shell
"requires Python 2.7 or >=3.5 for Windows")
def test_embeddable(self): def test_embeddable(self):
import subprocess import subprocess
import ctypes import ctypes
@ -355,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()

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