Skip to content

Commit

Permalink
Using typing_extensions for Annotated backport
Browse files Browse the repository at this point in the history
  • Loading branch information
cswartzvi committed Feb 10, 2025
1 parent d97d145 commit 023a384
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/test_type_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
from hamilton import htypes
from hamilton.htypes import check_instance

if sys.version_info >= (3, 9):
from typing import Annotated
else:
from typing_extensions import Annotated


class X:
pass
Expand Down Expand Up @@ -178,7 +183,7 @@ def test__safe_subclass(candidate, type_, expected):
(pd.Series),
(htypes.column[pd.Series, int]),
(pd.DataFrame),
(typing.Annotated[int, "metadata"]),
(Annotated[int, "metadata"]),
],
)
def test_get_type_as_string(type_):
Expand All @@ -191,7 +196,7 @@ def test_get_type_as_string(type_):

def test_type_as_string_with_annotated_type():
"""Tests the custom_subclass_check"""
type_string = htypes.get_type_as_string(typing.Annotated[int, "metadata"]) # type: ignore
type_string = htypes.get_type_as_string(Annotated[int, "metadata"]) # type: ignore
assert type_string == "int"


Expand Down

0 comments on commit 023a384

Please sign in to comment.