diff --git a/Tests/test_image_array.py b/Tests/test_image_array.py index eb2309e0f..25cb99c43 100644 --- a/Tests/test_image_array.py +++ b/Tests/test_image_array.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any +from typing import Any import pytest from packaging.version import parse as parse_version @@ -13,6 +13,7 @@ numpy = pytest.importorskip("numpy", reason="NumPy not installed") im = hopper().resize((128, 100)) +TYPE_CHECKING = False if TYPE_CHECKING: import numpy.typing as npt diff --git a/Tests/test_numpy.py b/Tests/test_numpy.py index c4ad19d23..ef54deeeb 100644 --- a/Tests/test_numpy.py +++ b/Tests/test_numpy.py @@ -1,7 +1,6 @@ from __future__ import annotations import warnings -from typing import TYPE_CHECKING import pytest @@ -9,6 +8,7 @@ from PIL import Image, _typing from .helper import assert_deep_equal, assert_image, hopper, skip_unless_feature +TYPE_CHECKING = False if TYPE_CHECKING: import numpy import numpy.typing as npt diff --git a/Tests/test_qt_image_qapplication.py b/Tests/test_qt_image_qapplication.py index 0ed9fbfa5..82a3e0741 100644 --- a/Tests/test_qt_image_qapplication.py +++ b/Tests/test_qt_image_qapplication.py @@ -1,7 +1,7 @@ from __future__ import annotations from pathlib import Path -from typing import TYPE_CHECKING, Union +from typing import Union import pytest @@ -9,6 +9,7 @@ from PIL import Image, ImageQt from .helper import assert_image_equal_tofile, assert_image_similar, hopper +TYPE_CHECKING = False if TYPE_CHECKING: import PyQt6 import PySide6 diff --git a/docs/dater.py b/docs/dater.py index f9fb0c1da..c0302b55c 100644 --- a/docs/dater.py +++ b/docs/dater.py @@ -8,8 +8,8 @@ from __future__ import annotations import re import subprocess -from typing import TYPE_CHECKING +TYPE_CHECKING = False if TYPE_CHECKING: from sphinx.application import Sphinx