[Python-checkins] bpo-46413: properly test `__{r}or__` code paths in `_SpecialGenericAlias` (GH-30640)
Fidget-Spinner
webhook-mailer at python.org
Wed Jan 19 10:32:36 EST 2022
https://github.com/python/cpython/commit/0a49148e87cca11e3820cbff2abfd316986a68c6
commit: 0a49148e87cca11e3820cbff2abfd316986a68c6
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: Fidget-Spinner <28750310+Fidget-Spinner at users.noreply.github.com>
date: 2022-01-19T23:32:25+08:00
summary:
bpo-46413: properly test `__{r}or__` code paths in `_SpecialGenericAlias` (GH-30640)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner at users.noreply.github.com>
files:
M Lib/test/test_typing.py
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index e61f8828f5405..8d024514fcb84 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -523,6 +523,10 @@ def test_ellipsis_in_generic(self):
# 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 B: ...
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):
More information about the Python-checkins
mailing list