Skip to content

[3.10] bpo-46413: properly test __{r}or__ code paths in _SpecialGenericAlias (GH-30640) #30694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
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