We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
typing._strip_annotations
1 parent 395029b commit 25c0b9dCopy full SHA for 25c0b9d
Lib/test/test_typing.py
@@ -3549,6 +3549,15 @@ def barfoo4(x: BA3): ...
3549
{"x": typing.Annotated[int | float, "const"]}
3550
)
3551
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
3561
def test_get_type_hints_annotated_refs(self):
3562
3563
Const = Annotated[T, "Const"]
0 commit comments