mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-30 23:47:27 +03:00 
			
		
		
		
	Merge pull request #4222 from jdufresne/unittest
Import unittest from stdlib rather than helper.py
This commit is contained in:
		
						commit
						1ab750a0b2
					
				|  | @ -1,8 +1,9 @@ | |||
| import time | ||||
| import unittest | ||||
| 
 | ||||
| from PIL import PyAccess | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, unittest | ||||
| from .helper import PillowTestCase, hopper | ||||
| 
 | ||||
| # Not running this test by default. No DOS against Travis CI. | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, unittest | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| TEST_FILE = "Tests/images/fli_overflow.fli" | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,7 +1,9 @@ | |||
| #!/usr/bin/env python | ||||
| import unittest | ||||
| 
 | ||||
| from PIL import Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, is_win32, unittest | ||||
| from .helper import PillowTestCase, is_win32 | ||||
| 
 | ||||
| min_iterations = 100 | ||||
| max_iterations = 10000 | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import unittest | ||||
| from io import BytesIO | ||||
| 
 | ||||
| from PIL import Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, is_win32, unittest | ||||
| from .helper import PillowTestCase, is_win32 | ||||
| 
 | ||||
| # Limits for testing the leak | ||||
| mem_limit = 1024 * 1048576 | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, unittest | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| 
 | ||||
| class TestJ2kEncodeOverflow(PillowTestCase): | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| import unittest | ||||
| from io import BytesIO | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, is_win32, unittest | ||||
| from .helper import PillowTestCase, hopper, is_win32 | ||||
| 
 | ||||
| iterations = 5000 | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import sys | ||||
| import unittest | ||||
| 
 | ||||
| from PIL import Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, unittest | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| # This test is not run automatically. | ||||
| # | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import sys | ||||
| import unittest | ||||
| 
 | ||||
| from PIL import Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, unittest | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| # This test is not run automatically. | ||||
| # | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, unittest | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| TEST_FILE = "Tests/images/libtiff_segfault.tif" | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,9 +1,10 @@ | |||
| import unittest | ||||
| import zlib | ||||
| from io import BytesIO | ||||
| 
 | ||||
| from PIL import Image, ImageFile, PngImagePlugin | ||||
| 
 | ||||
| from .helper import PillowTestCase, unittest | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| TEST_FILE = "Tests/images/png_decompression_dos.png" | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import unittest | ||||
| from array import array | ||||
| 
 | ||||
| from PIL import Image, ImageFilter | ||||
| 
 | ||||
| from .helper import PillowTestCase, unittest | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| try: | ||||
|     import numpy | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import sys | ||||
| import unittest | ||||
| 
 | ||||
| from PIL import Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, is_pypy, unittest | ||||
| from .helper import PillowTestCase, is_pypy | ||||
| 
 | ||||
| 
 | ||||
| class TestCoreStats(PillowTestCase): | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import io | ||||
| import unittest | ||||
| 
 | ||||
| from PIL import features | ||||
| 
 | ||||
| from .helper import PillowTestCase, unittest | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| try: | ||||
|     from PIL import _webp | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import io | ||||
| import unittest | ||||
| 
 | ||||
| from PIL import EpsImagePlugin, Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, unittest | ||||
| from .helper import PillowTestCase, hopper | ||||
| 
 | ||||
| HAS_GHOSTSCRIPT = EpsImagePlugin.has_ghostscript() | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,4 +1,6 @@ | |||
| from .helper import PillowTestCase, unittest | ||||
| import unittest | ||||
| 
 | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| try: | ||||
|     from PIL import FpxImagePlugin | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import unittest | ||||
| from io import BytesIO | ||||
| 
 | ||||
| from PIL import GifImagePlugin, Image, ImageDraw, ImagePalette | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, is_pypy, netpbm_available, unittest | ||||
| from .helper import PillowTestCase, hopper, is_pypy, netpbm_available | ||||
| 
 | ||||
| try: | ||||
|     from PIL import _webp | ||||
|  |  | |||
|  | @ -1,9 +1,10 @@ | |||
| import io | ||||
| import sys | ||||
| import unittest | ||||
| 
 | ||||
| from PIL import IcnsImagePlugin, Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, unittest | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| # sample icon file | ||||
| TEST_FILE = "Tests/images/pillow.icns" | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import Image, ImagePalette, features | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, unittest | ||||
| from .helper import PillowTestCase, hopper | ||||
| 
 | ||||
| try: | ||||
|     from PIL import MicImagePlugin | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import os | ||||
| import unittest | ||||
| 
 | ||||
| from PIL import Image, MspImagePlugin | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, unittest | ||||
| from .helper import PillowTestCase, hopper | ||||
| 
 | ||||
| TEST_FILE = "Tests/images/hopper.msp" | ||||
| EXTRA_DIR = "Tests/images/picins" | ||||
|  |  | |||
|  | @ -1,9 +1,10 @@ | |||
| import unittest | ||||
| import zlib | ||||
| from io import BytesIO | ||||
| 
 | ||||
| from PIL import Image, ImageFile, PngImagePlugin | ||||
| 
 | ||||
| from .helper import PillowLeakTestCase, PillowTestCase, hopper, is_win32, unittest | ||||
| from .helper import PillowLeakTestCase, PillowTestCase, hopper, is_win32 | ||||
| 
 | ||||
| try: | ||||
|     from PIL import _webp | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import os | ||||
| import unittest | ||||
| 
 | ||||
| from PIL import Image, SunImagePlugin | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, unittest | ||||
| from .helper import PillowTestCase, hopper | ||||
| 
 | ||||
| EXTRA_DIR = "Tests/images/sunraster" | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,12 +1,13 @@ | |||
| import logging | ||||
| import os | ||||
| import unittest | ||||
| from io import BytesIO | ||||
| 
 | ||||
| import pytest | ||||
| from PIL import Image, TiffImagePlugin | ||||
| from PIL.TiffImagePlugin import RESOLUTION_UNIT, X_RESOLUTION, Y_RESOLUTION | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, is_pypy, is_win32, unittest | ||||
| from .helper import PillowTestCase, hopper, is_pypy, is_win32 | ||||
| 
 | ||||
| logger = logging.getLogger(__name__) | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import Image, WebPImagePlugin | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, unittest | ||||
| from .helper import PillowTestCase, hopper | ||||
| 
 | ||||
| try: | ||||
|     from PIL import _webp | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, unittest | ||||
| from .helper import PillowTestCase, hopper | ||||
| 
 | ||||
| try: | ||||
|     from PIL import _webp | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import Image, ImageDraw, ImageFont, features | ||||
| 
 | ||||
| from .helper import PillowLeakTestCase, is_win32, unittest | ||||
| from .helper import PillowLeakTestCase, is_win32 | ||||
| 
 | ||||
| 
 | ||||
| @unittest.skipIf(is_win32(), "requires Unix or macOS") | ||||
|  |  | |||
|  | @ -1,10 +1,11 @@ | |||
| import os | ||||
| import shutil | ||||
| import tempfile | ||||
| import unittest | ||||
| 
 | ||||
| from PIL import Image, UnidentifiedImageError | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, is_win32, unittest | ||||
| from .helper import PillowTestCase, hopper, is_win32 | ||||
| 
 | ||||
| 
 | ||||
| class TestImage(PillowTestCase): | ||||
|  |  | |||
|  | @ -2,11 +2,12 @@ import ctypes | |||
| import os | ||||
| import subprocess | ||||
| import sys | ||||
| import unittest | ||||
| from distutils import ccompiler, sysconfig | ||||
| 
 | ||||
| from PIL import Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, is_win32, on_ci, unittest | ||||
| from .helper import PillowTestCase, hopper, is_win32, on_ci | ||||
| 
 | ||||
| # CFFI imports pycparser which doesn't support PYTHONOPTIMIZE=2 | ||||
| # https://github.com/eliben/pycparser/pull/198#issuecomment-317001670 | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import unittest | ||||
| from contextlib import contextmanager | ||||
| 
 | ||||
| from PIL import Image, ImageDraw | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, unittest | ||||
| from .helper import PillowTestCase, hopper | ||||
| 
 | ||||
| 
 | ||||
| class TestImagingResampleVulnerability(PillowTestCase): | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import os.path | ||||
| import unittest | ||||
| 
 | ||||
| from PIL import Image, ImageColor, ImageDraw, ImageFont, features | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, unittest | ||||
| from .helper import PillowTestCase, hopper | ||||
| 
 | ||||
| BLACK = (0, 0, 0) | ||||
| WHITE = (255, 255, 255) | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import os.path | ||||
| import unittest | ||||
| 
 | ||||
| from PIL import Image, ImageDraw2, features | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, unittest | ||||
| from .helper import PillowTestCase, hopper | ||||
| 
 | ||||
| BLACK = (0, 0, 0) | ||||
| WHITE = (255, 255, 255) | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import unittest | ||||
| from io import BytesIO | ||||
| 
 | ||||
| from PIL import EpsImagePlugin, Image, ImageFile | ||||
| 
 | ||||
| from .helper import PillowTestCase, fromstring, hopper, tostring, unittest | ||||
| from .helper import PillowTestCase, fromstring, hopper, tostring | ||||
| 
 | ||||
| try: | ||||
|     from PIL import _webp | ||||
|  |  | |||
|  | @ -4,11 +4,12 @@ import os | |||
| import re | ||||
| import shutil | ||||
| import sys | ||||
| import unittest | ||||
| from io import BytesIO | ||||
| 
 | ||||
| from PIL import Image, ImageDraw, ImageFont, features | ||||
| 
 | ||||
| from .helper import PillowTestCase, is_pypy, is_win32, unittest | ||||
| from .helper import PillowTestCase, is_pypy, is_win32 | ||||
| 
 | ||||
| FONT_PATH = "Tests/fonts/FreeMono.ttf" | ||||
| FONT_SIZE = 20 | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import Image, ImageDraw, ImageFont | ||||
| 
 | ||||
| from .helper import PillowTestCase, unittest | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| image_font_installed = True | ||||
| try: | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import Image, ImageDraw, ImageFont, features | ||||
| 
 | ||||
| from .helper import PillowTestCase, unittest | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| FONT_SIZE = 20 | ||||
| FONT_PATH = "Tests/fonts/DejaVuSans.ttf" | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import Image, ImageShow | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, is_win32, on_ci, on_github_actions, unittest | ||||
| from .helper import PillowTestCase, hopper, is_win32, on_ci, on_github_actions | ||||
| 
 | ||||
| 
 | ||||
| class TestImageShow(PillowTestCase): | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, unittest | ||||
| from .helper import PillowTestCase, hopper | ||||
| 
 | ||||
| try: | ||||
|     from PIL import ImageTk | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import ImageWin | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, is_win32, unittest | ||||
| from .helper import PillowTestCase, hopper, is_win32 | ||||
| 
 | ||||
| 
 | ||||
| class TestImageWin(PillowTestCase): | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, unittest | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| 
 | ||||
| class TestLibImage(PillowTestCase): | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import locale | ||||
| import unittest | ||||
| 
 | ||||
| from PIL import Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, unittest | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| # ref https://github.com/python-pillow/Pillow/issues/272 | ||||
| # on windows, in polish locale: | ||||
|  |  | |||
|  | @ -1,9 +1,10 @@ | |||
| import os | ||||
| import subprocess | ||||
| import sys | ||||
| import unittest | ||||
| from unittest import TestCase | ||||
| 
 | ||||
| from .helper import is_pypy, is_win32, on_github_actions, unittest | ||||
| from .helper import is_pypy, is_win32, on_github_actions | ||||
| 
 | ||||
| 
 | ||||
| class TestMain(TestCase): | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import sys | ||||
| import unittest | ||||
| 
 | ||||
| from PIL import Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, is_win32, unittest | ||||
| from .helper import PillowTestCase, is_win32 | ||||
| 
 | ||||
| try: | ||||
|     import numpy | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import Image | ||||
| 
 | ||||
| from .helper import PillowTestCase, hopper, unittest | ||||
| from .helper import PillowTestCase, hopper | ||||
| 
 | ||||
| try: | ||||
|     import numpy | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import __version__ | ||||
| 
 | ||||
| from .helper import PillowTestCase, unittest | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| try: | ||||
|     import pyroma | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| 
 | ||||
| from PIL import _util | ||||
| 
 | ||||
| from .helper import PillowTestCase, unittest | ||||
| from .helper import PillowTestCase | ||||
| 
 | ||||
| 
 | ||||
| class TestUtil(PillowTestCase): | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import unittest | ||||
| from io import BytesIO | ||||
| 
 | ||||
| from PIL import Image, features | ||||
| 
 | ||||
| from .helper import PillowLeakTestCase, unittest | ||||
| from .helper import PillowLeakTestCase | ||||
| 
 | ||||
| test_file = "Tests/images/hopper.webp" | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user