mirror of
https://github.com/python/cpython.git
synced 2025-11-08 13:42:22 +00:00
bpo-46413: properly test __{r}or__ code paths in _SpecialGenericAlias (GH-30640)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
This commit is contained in:
parent
0eae9a2a2d
commit
0a49148e87
1 changed files with 8 additions and 0 deletions
|
|
@ -523,6 +523,10 @@ class BaseCallableTests:
|
||||||
# Shouldn't crash; see https://github.com/python/typing/issues/259
|
# Shouldn't crash; see https://github.com/python/typing/issues/259
|
||||||
typing.List[Callable[..., str]]
|
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):
|
def test_basic(self):
|
||||||
Callable = self.Callable
|
Callable = self.Callable
|
||||||
|
|
@ -3906,6 +3910,10 @@ class CollectionsAbcTests(BaseTestCase):
|
||||||
A.register(B)
|
A.register(B)
|
||||||
self.assertIsSubclass(B, typing.Mapping)
|
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):
|
class OtherABCTests(BaseTestCase):
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue