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

Skip to content

Commit 39374c4

[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 0a49148) Co-authored-by: Nikita Sobolev <mail@sobolevn.me> Automerge-Triggered-By: GH:Fidget-Spinner
1 parent baf26d0 commit 39374c4

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
@@ -515,6 +515,10 @@ def test_ellipsis_in_generic(self):
515515
# Shouldn't crash; see https://github.com/python/typing/issues/259
516516
typing.List[Callable[..., str]]
517517

518+
def test_or_and_ror(self):
519+
Callable = self.Callable
520+
self.assertEqual(Callable | Tuple, Union[Callable, Tuple])
521+
self.assertEqual(Tuple | Callable, Union[Tuple, Callable])
518522

519523
def test_basic(self):
520524
Callable = self.Callable
@@ -3834,6 +3838,10 @@ class B: ...
38343838
A.register(B)
38353839
self.assertIsSubclass(B, typing.Mapping)
38363840

3841+
def test_or_and_ror(self):
3842+
self.assertEqual(typing.Sized | typing.Awaitable, Union[typing.Sized, typing.Awaitable])
3843+
self.assertEqual(typing.Coroutine | typing.Hashable, Union[typing.Coroutine, typing.Hashable])
3844+
38373845

38383846
class OtherABCTests(BaseTestCase):
38393847

0 commit comments

Comments
 (0)
0