summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-07-30 09:31:54 (GMT)
committerGitHub <noreply@github.com>2021-07-30 09:31:54 (GMT)
commit472997659b9c73089cdc22bd7eded6f6fdcffdfe (patch)
treee8812bf1b0805d9b2ce1c1be340be139b05ab13f /Lib
parent0b984d1cccc9547c2c16203e9ab2b2959fbabcde (diff)
downloadcpython-472997659b9c73089cdc22bd7eded6f6fdcffdfe.zip
cpython-472997659b9c73089cdc22bd7eded6f6fdcffdfe.tar.gz
cpython-472997659b9c73089cdc22bd7eded6f6fdcffdfe.tar.bz2
bpo-44662: Add ability to annotate types.Union (GH-27214) (GH-27461)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> (cherry picked from commit 8182c8329c709f42218a8a17d81639ece5b7b627) Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
Diffstat (limited to 'Lib')
-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 f79675b..bbda6aa 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -3009,6 +3009,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):