diff --git a/src/bigxml/handle_mgr.py b/src/bigxml/handle_mgr.py index 280c485..0bb4c17 100644 --- a/src/bigxml/handle_mgr.py +++ b/src/bigxml/handle_mgr.py @@ -1,3 +1,4 @@ +import sys from typing import ( TYPE_CHECKING, Any, @@ -20,16 +21,14 @@ ) from bigxml.utils import last_item_or_none -if TYPE_CHECKING: - import sys +if sys.version_info < (3, 11): # pragma: no cover + from typing_extensions import Never +else: # pragma: no cover + from typing import Never +if TYPE_CHECKING: from bigxml.nodes import XMLElement, XMLText - if sys.version_info < (3, 11): # pragma: no cover - from typing import NoReturn as Never - else: # pragma: no cover - from typing import Never - class HandleMgr: _handle: Optional[ diff --git a/tests/integration/test_typing.py b/tests/integration/test_typing.py index e2e29e0..42fe37e 100644 --- a/tests/integration/test_typing.py +++ b/tests/integration/test_typing.py @@ -1,6 +1,6 @@ from dataclasses import dataclass import sys -from typing import TYPE_CHECKING, Any, Iterable, Iterator, Optional, Tuple, Union +from typing import Iterable, Iterator, Optional, Tuple, Union from bigxml import ( HandlerTypeHelper, @@ -12,16 +12,9 @@ ) if sys.version_info < (3, 11): - from typing import NoReturn as Never + from typing_extensions import Never, assert_type else: - from typing import Never - -if TYPE_CHECKING: - from typing_extensions import assert_type -else: - - def assert_type(val: Any, _: Any) -> Any: # noqa: ANN401 - return val + from typing import Never, assert_type # Note: the aim of this file is to test the typing of return-values