Skip to content
Closed
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 @@ -494,6 +494,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])

class LiteralTests(BaseTestCase):
def test_basics(self):
Expand Down Expand Up @@ -3629,6 +3633,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