8000 bpo-46413: properly test `__{r}or__` code paths in `_SpecialGenericAl… · python/cpython@0a49148 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0a49148

Browse files
bpo-46413: properly test __{r}or__ code paths in _SpecialGenericAlias (GH-30640)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
1 parent 0eae9a2 commit 0a49148

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Lib/test/test_typing.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,10 @@ def test_ellipsis_in_generic(self):
523523
# Shouldn't crash; see https://github.com/python/typing/issues/259
524524
typing.List[Callable[..., str]]
525525

526+
def test_or_and_ror(self):
527+
Callable = self.Callable
528+
self.assertEqual(Callable | Tuple, Union[Callable, Tuple])
529+
self.assertEqual(Tuple | Callable, Union[Tuple, Callable])
526530

527531
def test_basic(self):
528532
Callable = self.Callable
@@ -3906,6 +3910,10 @@ class B: ...
39063910
A.register(B)
39073911
self.assertIsSubclass(B, typing.Mapping)
39083912

3913+
def test_or_and_ror(self):
3914+
self.assertEqual(typing.Sized | typing.Awaitable, Union[typing.Sized, typing.Awaitable])
3915+
self.assertEqual(typing.Coroutine | typing.Hashable, Union[typing.Coroutine, typing.Hashable])
3916+
39093917

39103918
class OtherABCTests(BaseTestCase):
39113919

0 commit comments

Comments
 (0)
0