Skip to content

Commit 1f290f1

Browse files
committed
Use typing_extensions only if needed
This makes the typing-extensions test dependency < 3.11 only, and conditionally imports assert_type from typing or typing_extensions depending on the Python version.
1 parent 18608e4 commit 1f290f1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

test-requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ pytest-cov
88
pytest-instafail
99
pytest-mock
1010
pytest-sugar
11-
typing-extensions
11+
typing-extensions ; python_version < "3.11"

test/deprecation/test_attributes.py

+6
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@
99
"""
1010

1111
import itertools
12+
import sys
1213
from typing import Type
1314

15+
if sys.version_info >= (3, 11):
16+
from typing import assert_type
17+
else:
18+
from typing_extensions import assert_type
19+
1420
import pytest
1521
from typing_extensions import assert_type
1622

0 commit comments

Comments
 (0)