mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-46603: improve coverage of typing._strip_annotations
(GH-31063)
This commit is contained in:
parent
395029b0bd
commit
25c0b9d243
1 changed files with 9 additions and 0 deletions
|
@ -3549,6 +3549,15 @@ class GetTypeHintTests(BaseTestCase):
|
|||
{"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"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue