summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2022-01-19 15:32:25 (GMT)
committerGitHub <noreply@github.com>2022-01-19 15:32:25 (GMT)
commit0a49148e87cca11e3820cbff2abfd316986a68c6 (patch)
treec9c7977e47e27a61f26caf9653bf649de60142be
parent0eae9a2a2db6cc5a72535f61bb988cc417011640 (diff)
downloadcpython-0a49148e87cca11e3820cbff2abfd316986a68c6.zip
cpython-0a49148e87cca11e3820cbff2abfd316986a68c6.tar.gz
cpython-0a49148e87cca11e3820cbff2abfd316986a68c6.tar.bz2
bpo-46413: properly test `__{r}or__` code paths in `_SpecialGenericAlias` (GH-30640)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
-rw-r--r--Lib/test/test_typing.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index e61f882..8d02451 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -523,6 +523,10 @@ class BaseCallableTests:
# Shouldn't crash; see https://github.com/python/typing/issues/259
typing.List[Callable[..., str]]
+ def test_or_and_ror(self):
+ Callable = self.Callable
+ self.assertEqual(Callable | Tuple, Union[Callable, Tuple])
+ self.assertEqual(Tuple | Callable, Union[Tuple, Callable])
def test_basic(self):
Callable = self.Callable
@@ -3906,6 +3910,10 @@ class CollectionsAbcTests(BaseTestCase):
A.register(B)
self.assertIsSubclass(B, typing.Mapping)
+ def test_or_and_ror(self):
+ self.assertEqual(typing.Sized | typing.Awaitable, Union[typing.Sized, typing.Awaitable])
+ self.assertEqual(typing.Coroutine | typing.Hashable, Union[typing.Coroutine, typing.Hashable])
+
class OtherABCTests(BaseTestCase):