Remove unnecessary unittest.main() boilerplate from test files

With the introduction and use of pytest, it is simple and easy to
execute specific tests in isolation through documented command line
arguments. Either by specifying the module path or through the `-k
EXPRESSION` argument. There is no longer any need to provide the
boilerplate:

    if __name__ == '__main__':
        unittest.main()

To every test file. It is simply noise.

The pattern remains in test files that aren't named with `test_*` as
those files are not discovered and executed by pytest by default.
This commit is contained in:
Jon Dufresne 2019-02-03 07:34:53 -08:00
parent 168e51751e
commit 4de5477b61
147 changed files with 123 additions and 718 deletions

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

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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -602,7 +602,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
@ -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,5 +1,3 @@
from .helper import unittest
from PIL import Image from PIL import Image
from .test_file_libtiff import LibTiffTestCase from .test_file_libtiff import 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

@ -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
@ -142,7 +142,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

@ -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

@ -626,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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -560,7 +560,3 @@ class TestRegistry(PillowTestCase):
'DoesNotExist', 'DoesNotExist',
('args',), ('args',),
extra=('extra',)) extra=('extra',))
if __name__ == '__main__':
unittest.main()

View File

@ -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,4 +1,4 @@
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()

View File

@ -1,5 +1,5 @@
from PIL import Image from PIL import Image
from .helper import unittest, PillowTestCase, hopper from .helper import PillowTestCase, hopper
class TestImageGetExtrema(PillowTestCase): class TestImageGetExtrema(PillowTestCase):
@ -27,7 +27,3 @@ class TestImageGetExtrema(PillowTestCase):
self.assertEqual(im.mode, 'I;16') self.assertEqual(im.mode, 'I;16')
extrema = im.getextrema() extrema = im.getextrema()
self.assertEqual(extrema, (106, 285)) self.assertEqual(extrema, (106, 285))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from .helper import unittest, PillowTestCase, hopper from .helper import PillowTestCase, hopper
from PIL._util import py3 from PIL._util import py3
@ -12,7 +12,3 @@ class TestImageGetIm(PillowTestCase):
self.assertIn("PyCapsule", type_repr) self.assertIn("PyCapsule", type_repr)
self.assertIsInstance(im.im.id, int) self.assertIsInstance(im.im.id, int)
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from .helper import unittest, PillowTestCase, hopper from .helper import PillowTestCase, hopper
class TestImageGetPalette(PillowTestCase): class TestImageGetPalette(PillowTestCase):
@ -18,7 +18,3 @@ class TestImageGetPalette(PillowTestCase):
self.assertIsNone(palette("RGBA")) self.assertIsNone(palette("RGBA"))
self.assertIsNone(palette("CMYK")) self.assertIsNone(palette("CMYK"))
self.assertIsNone(palette("YCbCr")) self.assertIsNone(palette("YCbCr"))
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
@ -30,7 +30,3 @@ class TestImageGetProjection(PillowTestCase):
im.paste(255, (2, 4, 8, 6)) im.paste(255, (2, 4, 8, 6))
self.assertEqual(im.getprojection()[0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0]) self.assertEqual(im.getprojection()[0], [0, 0, 1, 1, 1, 1, 1, 1, 0, 0])
self.assertEqual(im.getprojection()[1], [0, 0, 0, 0, 1, 1, 0, 0, 0, 0]) self.assertEqual(im.getprojection()[1], [0, 0, 0, 0, 1, 1, 0, 0, 0, 0])
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from .helper import unittest, PillowTestCase, hopper from .helper import PillowTestCase, hopper
class TestImageHistogram(PillowTestCase): class TestImageHistogram(PillowTestCase):
@ -18,7 +18,3 @@ class TestImageHistogram(PillowTestCase):
self.assertEqual(histogram("RGBA"), (1024, 0, 16384)) self.assertEqual(histogram("RGBA"), (1024, 0, 16384))
self.assertEqual(histogram("CMYK"), (1024, 0, 16384)) self.assertEqual(histogram("CMYK"), (1024, 0, 16384))
self.assertEqual(histogram("YCbCr"), (768, 0, 1908)) self.assertEqual(histogram("YCbCr"), (768, 0, 1908))
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
@ -28,7 +28,3 @@ class TestImageLoad(PillowTestCase):
os.fstat(fn) os.fstat(fn)
self.assertRaises(OSError, os.fstat, fn) self.assertRaises(OSError, os.fstat, fn)
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
@ -51,7 +51,3 @@ class TestImageMode(PillowTestCase):
check("RGBX", "RGB", "L", 4, ("R", "G", "B", "X")) check("RGBX", "RGB", "L", 4, ("R", "G", "B", "X"))
check("CMYK", "RGB", "L", 4, ("C", "M", "Y", "K")) check("CMYK", "RGB", "L", 4, ("C", "M", "Y", "K"))
check("YCbCr", "RGB", "L", 3, ("Y", "Cb", "Cr")) check("YCbCr", "RGB", "L", 3, ("Y", "Cb", "Cr"))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from .helper import unittest, PillowTestCase, cached_property from .helper import PillowTestCase, cached_property
from PIL import Image from PIL import Image
@ -250,7 +250,3 @@ class TestImagingPaste(PillowTestCase):
im.copy().paste(im2) im.copy().paste(im2)
im.copy().paste(im2, (0, 0)) im.copy().paste(im2, (0, 0))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from .helper import unittest, PillowTestCase, hopper from .helper import PillowTestCase, hopper
class TestImagePoint(PillowTestCase): class TestImagePoint(PillowTestCase):
@ -38,7 +38,3 @@ class TestImagePoint(PillowTestCase):
def test_f_mode(self): def test_f_mode(self):
im = hopper('F') im = hopper('F')
self.assertRaises(ValueError, im.point, None) self.assertRaises(ValueError, im.point, None)
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
@ -44,7 +44,3 @@ class TestImagePutAlpha(PillowTestCase):
self.assertFalse(im.readonly) self.assertFalse(im.readonly)
self.assertEqual(im.mode, 'RGBA') self.assertEqual(im.mode, 'RGBA')
self.assertEqual(im.getpixel((0, 0)), (1, 2, 3, 4)) self.assertEqual(im.getpixel((0, 0)), (1, 2, 3, 4))
if __name__ == '__main__':
unittest.main()

View File

@ -1,4 +1,4 @@
from .helper import unittest, PillowTestCase, hopper from .helper import PillowTestCase, hopper
from array import array from array import array
import sys import sys
@ -83,7 +83,3 @@ class TestImagePutData(PillowTestCase):
im.putdata(arr) im.putdata(arr)
self.assertEqual(len(im.getdata()), len(arr)) self.assertEqual(len(im.getdata()), len(arr))
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 ImagePalette from PIL import ImagePalette
@ -28,7 +28,3 @@ class TestImagePutPalette(PillowTestCase):
im.putpalette(ImagePalette.random()) im.putpalette(ImagePalette.random())
im.putpalette(ImagePalette.sepia()) im.putpalette(ImagePalette.sepia())
im.putpalette(ImagePalette.wedge()) im.putpalette(ImagePalette.wedge())
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
@ -46,7 +46,3 @@ class TestImageQuantize(PillowTestCase):
converted = image.quantize() converted = image.quantize()
self.assert_image(converted, 'P', converted.size) self.assert_image(converted, 'P', converted.size)
self.assert_image_similar(converted.convert('RGB'), image, 1) self.assert_image_similar(converted.convert('RGB'), image, 1)
if __name__ == '__main__':
unittest.main()

View File

@ -544,7 +544,3 @@ class CoreResampleBoxTest(PillowTestCase):
except AssertionError: except AssertionError:
print('>>>', size, box, flt) print('>>>', size, box, flt)
raise raise
if __name__ == '__main__':
unittest.main()

View File

@ -3,7 +3,7 @@ Tests for resize functionality.
""" """
from itertools import permutations from itertools import permutations
from .helper import unittest, PillowTestCase, hopper from .helper import PillowTestCase, hopper
from PIL import Image from PIL import Image
@ -115,7 +115,3 @@ class TestImageResize(PillowTestCase):
# Test unknown resampling filter # Test unknown resampling filter
im = hopper() im = hopper()
self.assertRaises(ValueError, im.resize, (10, 10), "unknown") self.assertRaises(ValueError, im.resize, (10, 10), "unknown")
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
@ -123,7 +123,3 @@ class TestImageRotate(PillowTestCase):
im = im.rotate(45, expand=1, fillcolor=(255, 0, 0, 255)) im = im.rotate(45, expand=1, fillcolor=(255, 0, 0, 255))
corner = im.getpixel((0, 0)) corner = im.getpixel((0, 0))
self.assertEqual(corner, (255, 0, 0, 255)) self.assertEqual(corner, (255, 0, 0, 255))
if __name__ == '__main__':
unittest.main()

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