summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_typing.py
diff options
context:
space:
mode:
authorYurii Karabas <1998uriyyo@gmail.com>2021-07-29 19:44:48 (GMT)
committerGitHub <noreply@github.com>2021-07-29 19:44:48 (GMT)
commit8182c8329c709f42218a8a17d81639ece5b7b627 (patch)
treef79f5bdea92284fe69a4e6f671b6e7aaeece05fc /Lib/test/test_typing.py
parent6b61d74a3bab43a44fa47b1facd1bec3d74e12b1 (diff)
downloadcpython-8182c8329c709f42218a8a17d81639ece5b7b627.zip
cpython-8182c8329c709f42218a8a17d81639ece5b7b627.tar.gz
cpython-8182c8329c709f42218a8a17d81639ece5b7b627.tar.bz2
bpo-44662: Add ability to annotate types.Union (#27214)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Diffstat (limited to 'Lib/test/test_typing.py')
-rw-r--r--Lib/test/test_typing.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index 3aed26b..bc9021a 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -3015,6 +3015,16 @@ class GetTypeHintTests(BaseTestCase):
get_type_hints(barfoo3, globals(), locals(), include_extras=True)["x"],
BA2
)
+ BA3 = typing.Annotated[int | float, "const"]
+ def barfoo4(x: BA3): ...
+ self.assertEqual(
+ get_type_hints(barfoo4, globals(), locals()),
+ {"x": int | float}
+ )
+ self.assertEqual(
+ get_type_hints(barfoo4, globals(), locals(), include_extras=True),
+ {"x": typing.Annotated[int | float, "const"]}
+ )
def test_get_type_hints_annotated_refs(self):