diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-01-19 16:11:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-19 16:11:12 (GMT) |
commit | 39374c44d98b470213256ceead0e2b4e44b14b92 (patch) | |
tree | e6a3f26d7f6aa267cc749473cf8d5005e3f3dccf /Lib/test | |
parent | baf26d07a634b0ea3ff052716bdeaee985b3a3a9 (diff) | |
download | cpython-39374c44d98b470213256ceead0e2b4e44b14b92.zip cpython-39374c44d98b470213256ceead0e2b4e44b14b92.tar.gz cpython-39374c44d98b470213256ceead0e2b4e44b14b92.tar.bz2 |
[3.10] bpo-46413: properly test `__{r}or__` code paths in `_SpecialGenericAlias` (GH-30640) (GH-30694)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
(cherry picked from commit 0a49148e87cca11e3820cbff2abfd316986a68c6)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Automerge-Triggered-By: GH:Fidget-Spinner
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_typing.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index b886c38..ee432b6 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -515,6 +515,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 @@ -3834,6 +3838,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): |