From 021aceea7a2fb6700b37530ac78e656f68450737 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sun, 26 Oct 2025 12:25:55 +0000 Subject: [PATCH 1/3] Add typing-extensions to test deps. for Python <3.9 Add `typing-extensions` to `requirements-tests.txt` since `tests/test_main.py` imports it; but at the same time, since `typing` in the Python standard library provides both `Annotated` and `get_type_hints`, adapt the tests to use the standard library instead on Python 3.9 and later. --- requirements-tests.txt | 1 + tests/test_main.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/requirements-tests.txt b/requirements-tests.txt index 15fcdb6..bc6acb9 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -1,6 +1,7 @@ -e . pytest >=8.3.5 +typing-extensions; python_version < "3.9" coverage[toml] >=7.6.1 mypy ==1.14.1 ruff ==0.14.1 diff --git a/tests/test_main.py b/tests/test_main.py index b2a55d0..77791cb 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,6 +1,10 @@ import pickle -from typing_extensions import Annotated, get_type_hints +try: + from typing import Annotated, get_type_hints +except ImportError: + # Python < 3.9 + from typing_extensions import Annotated, get_type_hints from annotated_doc import Doc From fb508a3243e94f41678c95b733e81f59082c4aad Mon Sep 17 00:00:00 2001 From: Ben Beasley Date: Mon, 27 Oct 2025 12:12:03 +0000 Subject: [PATCH 2/3] Use an explicit version check to import typing or typing_extensions Co-authored-by: Sofie Van Landeghem --- tests/test_main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_main.py b/tests/test_main.py index 77791cb..bef9685 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,9 +1,10 @@ import pickle -try: +import sys + +if sys.version_info >= (3, 9): from typing import Annotated, get_type_hints -except ImportError: - # Python < 3.9 +else: from typing_extensions import Annotated, get_type_hints from annotated_doc import Doc From e1fb4d56d0643daf08a798deb76cc4c809d22676 Mon Sep 17 00:00:00 2001 From: svlandeg Date: Thu, 30 Oct 2025 20:38:14 +0100 Subject: [PATCH 3/3] fix imports formatting --- tests/test_main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/test_main.py b/tests/test_main.py index bef9685..c85dabf 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,14 +1,13 @@ import pickle - import sys +from annotated_doc import Doc + if sys.version_info >= (3, 9): from typing import Annotated, get_type_hints else: from typing_extensions import Annotated, get_type_hints -from annotated_doc import Doc - def test_doc_basic() -> None: doc = Doc("This is a test documentation.")