Skip to content

Commit

Permalink
[3.10] bpo-46413: properly test __{r}or__ code paths in `_SpecialGe…
Browse files Browse the repository at this point in the history
…nericAlias` (GH-30640) (GH-30694)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
(cherry picked from commit 0a49148)


Co-authored-by: Nikita Sobolev <mail@sobolevn.me>

Automerge-Triggered-By: GH:Fidget-Spinner
  • Loading branch information
miss-islington committed Jan 19, 2022
1 parent baf26d0 commit 39374c4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Lib/test/test_typing.py
Expand Up @@ -515,6 +515,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
Expand Down Expand Up @@ -3834,6 +3838,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):

Expand Down

0 comments on commit 39374c4

Please sign in to comment.