Skip to content

Commit 021acee

Browse files
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.
1 parent a8a8b63 commit 021acee

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

requirements-tests.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-e .
22

33
pytest >=8.3.5
4+
typing-extensions; python_version < "3.9"
45
coverage[toml] >=7.6.1
56
mypy ==1.14.1
67
ruff ==0.14.1

tests/test_main.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import pickle
22

3-
from typing_extensions import Annotated, get_type_hints
3+
try:
4+
from typing import Annotated, get_type_hints
5+
except ImportError:
6+
# Python < 3.9
7+
from typing_extensions import Annotated, get_type_hints
48

59
from annotated_doc import Doc
610

0 commit comments

Comments
 (0)