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 e05e3d2 commit 103f3caCopy full SHA for 103f3ca
Lib/test/test_typing.py
@@ -3305,6 +3305,15 @@ def barfoo4(x: BA3): ...
3305
{"x": typing.Annotated[int | float, "const"]}
3306
)
3307
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
3317
def test_get_type_hints_annotated_refs(self):
3318
3319
Const = Annotated[T, "Const"]
0 commit comments