Skip to content

Commit

Permalink
bpo-46603: improve coverage of typing._strip_annotations (GH-31063)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Feb 19, 2022
1 parent 395029b commit 25c0b9d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Lib/test/test_typing.py
Expand Up @@ -3549,6 +3549,15 @@ def barfoo4(x: BA3): ...
{"x": typing.Annotated[int | float, "const"]}
)

def test_get_type_hints_annotated_in_union(self): # bpo-46603
def with_union(x: int | list[Annotated[str, 'meta']]): ...

self.assertEqual(get_type_hints(with_union), {'x': int | list[str]})
self.assertEqual(
get_type_hints(with_union, include_extras=True),
{'x': int | list[Annotated[str, 'meta']]},
)

def test_get_type_hints_annotated_refs(self):

Const = Annotated[T, "Const"]
Expand Down

0 comments on commit 25c0b9d

Please sign in to comment.