Skip to content

Commit 023a384

Browse files
committed
Using typing_extensions for Annotated backport
1 parent d97d145 commit 023a384

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/test_type_utils.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
from hamilton import htypes
1010
from hamilton.htypes import check_instance
1111

12+
if sys.version_info >= (3, 9):
13+
from typing import Annotated
14+
else:
15+
from typing_extensions import Annotated
16+
1217

1318
class X:
1419
pass
@@ -178,7 +183,7 @@ def test__safe_subclass(candidate, type_, expected):
178183
(pd.Series),
179184
(htypes.column[pd.Series, int]),
180185
(pd.DataFrame),
181-
(typing.Annotated[int, "metadata"]),
186+
(Annotated[int, "metadata"]),
182187
],
183188
)
184189
def test_get_type_as_string(type_):
@@ -191,7 +196,7 @@ def test_get_type_as_string(type_):
191196

192197
def test_type_as_string_with_annotated_type():
193198
"""Tests the custom_subclass_check"""
194-
type_string = htypes.get_type_as_string(typing.Annotated[int, "metadata"]) # type: ignore
199+
type_string = htypes.get_type_as_string(Annotated[int, "metadata"]) # type: ignore
195200
assert type_string == "int"
196201

197202

0 commit comments

Comments
 (0)