Skip to content

Commit 25c0b9d

Browse files
authored
bpo-46603: improve coverage of typing._strip_annotations (GH-31063)
1 parent 395029b commit 25c0b9d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Lib/test/test_typing.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3549,6 +3549,15 @@ def barfoo4(x: BA3): ...
35493549
{"x": typing.Annotated[int | float, "const"]}
35503550
)
35513551

3552+
def test_get_type_hints_annotated_in_union(self): # bpo-46603
3553+
def with_union(x: int | list[Annotated[str, 'meta']]): ...
3554+
3555+
self.assertEqual(get_type_hints(with_union), {'x': int | list[str]})
3556+
self.assertEqual(
3557+
get_type_hints(with_union, include_extras=True),
3558+
{'x': int | list[Annotated[str, 'meta']]},
3559+
)
3560+
35523561
def test_get_type_hints_annotated_refs(self):
35533562

35543563
Const = Annotated[T, "Const"]

0 commit comments

Comments
 (0)