Merge pull request #7644 from radarhere/import

This commit is contained in:
Hugo van Kemenade 2024-03-12 14:21:41 +02:00 committed by GitHub
commit 2753057806
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 9 deletions

View File

@ -7,7 +7,7 @@ import fuzzers
import packaging import packaging
import pytest import pytest
from PIL import Image, features from PIL import Image, UnidentifiedImageError, features
from Tests.helper import skip_unless_feature from Tests.helper import skip_unless_feature
if sys.platform.startswith("win32"): if sys.platform.startswith("win32"):
@ -43,7 +43,7 @@ def test_fuzz_images(path: str) -> None:
except ( except (
Image.DecompressionBombError, Image.DecompressionBombError,
Image.DecompressionBombWarning, Image.DecompressionBombWarning,
Image.UnidentifiedImageError, UnidentifiedImageError,
): ):
# Known Image.* exceptions # Known Image.* exceptions
assert True assert True

View File

@ -5,7 +5,7 @@ from pathlib import Path
import pytest import pytest
from PIL import EpsImagePlugin, Image, features from PIL import EpsImagePlugin, Image, UnidentifiedImageError, features
from .helper import ( from .helper import (
assert_image_similar, assert_image_similar,
@ -419,7 +419,7 @@ def test_emptyline() -> None:
) )
def test_timeout(test_file: str) -> None: def test_timeout(test_file: str) -> None:
with open(test_file, "rb") as f: with open(test_file, "rb") as f:
with pytest.raises(Image.UnidentifiedImageError): with pytest.raises(UnidentifiedImageError):
with Image.open(f): with Image.open(f):
pass pass

View File

@ -4,7 +4,7 @@ import warnings
import pytest import pytest
from PIL import Image, PsdImagePlugin from PIL import Image, PsdImagePlugin, UnidentifiedImageError
from .helper import assert_image_equal_tofile, assert_image_similar, hopper, is_pypy from .helper import assert_image_equal_tofile, assert_image_similar, hopper, is_pypy
@ -152,11 +152,11 @@ def test_combined_larger_than_size() -> None:
[ [
( (
"Tests/images/timeout-1ee28a249896e05b83840ae8140622de8e648ba9.psd", "Tests/images/timeout-1ee28a249896e05b83840ae8140622de8e648ba9.psd",
Image.UnidentifiedImageError, UnidentifiedImageError,
), ),
( (
"Tests/images/timeout-598843abc37fc080ec36a2699ebbd44f795d3a6f.psd", "Tests/images/timeout-598843abc37fc080ec36a2699ebbd44f795d3a6f.psd",
Image.UnidentifiedImageError, UnidentifiedImageError,
), ),
("Tests/images/timeout-c8efc3fded6426986ba867a399791bae544f59bc.psd", OSError), ("Tests/images/timeout-c8efc3fded6426986ba867a399791bae544f59bc.psd", OSError),
("Tests/images/timeout-dedc7a4ebd856d79b4359bbcc79e8ef231ce38f6.psd", OSError), ("Tests/images/timeout-dedc7a4ebd856d79b4359bbcc79e8ef231ce38f6.psd", OSError),

View File

@ -25,7 +25,7 @@ from enum import IntEnum, IntFlag
from functools import reduce from functools import reduce
from typing import Any from typing import Any
from . import Image from . import Image, __version__
from ._deprecate import deprecate from ._deprecate import deprecate
try: try:
@ -1087,4 +1087,4 @@ def versions():
12, 12,
'(PIL.features.version("littlecms2"), sys.version, PIL.__version__)', '(PIL.features.version("littlecms2"), sys.version, PIL.__version__)',
) )
return _VERSION, core.littlecms_version, sys.version.split()[0], Image.__version__ return _VERSION, core.littlecms_version, sys.version.split()[0], __version__