Skip to content

Commit 103f3ca

Browse files
bpo-46603: improve coverage of typing._strip_annotations (GH-31063)
(cherry picked from commit 25c0b9d) Co-authored-by: Nikita Sobolev <[email protected]>
1 parent e05e3d2 commit 103f3ca

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
@@ -3305,6 +3305,15 @@ def barfoo4(x: BA3): ...
33053305
{"x": typing.Annotated[int | float, "const"]}
33063306
)
33073307

3308+
def test_get_type_hints_annotated_in_union(self): # bpo-46603
3309+
def with_union(x: int | list[Annotated[str, 'meta']]): ...
3310+
3311+
self.assertEqual(get_type_hints(with_union), {'x': int | list[str]})
3312+
self.assertEqual(
3313+
get_type_hints(with_union, include_extras=True),
3314+
{'x': int | list[Annotated[str, 'meta']]},
3315+
)
3316+
33083317
def test_get_type_hints_annotated_refs(self):
33093318

33103319
Const = Annotated[T, "Const"]

0 commit comments

Comments
 (0)