mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
[3.11] gh-98513: Test abstract methods of some collections types (GH-98516) (#99226)
(cherry picked from commit a309ad9f76)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
parent
42fb233c52
commit
1add2393a8
1 changed files with 5 additions and 0 deletions
|
|
@ -802,6 +802,8 @@ def throw(self, typ, val=None, tb=None):
|
|||
def __await__(self):
|
||||
yield
|
||||
|
||||
self.validate_abstract_methods(Awaitable, '__await__')
|
||||
|
||||
non_samples = [None, int(), gen(), object()]
|
||||
for x in non_samples:
|
||||
self.assertNotIsInstance(x, Awaitable)
|
||||
|
|
@ -852,6 +854,8 @@ def throw(self, typ, val=None, tb=None):
|
|||
def __await__(self):
|
||||
yield
|
||||
|
||||
self.validate_abstract_methods(Coroutine, '__await__', 'send', 'throw')
|
||||
|
||||
non_samples = [None, int(), gen(), object(), Bar()]
|
||||
for x in non_samples:
|
||||
self.assertNotIsInstance(x, Coroutine)
|
||||
|
|
@ -1935,6 +1939,7 @@ def test_ByteString(self):
|
|||
self.assertFalse(issubclass(sample, ByteString))
|
||||
self.assertNotIsInstance(memoryview(b""), ByteString)
|
||||
self.assertFalse(issubclass(memoryview, ByteString))
|
||||
self.validate_abstract_methods(ByteString, '__getitem__', '__len__')
|
||||
|
||||
def test_MutableSequence(self):
|
||||
for sample in [tuple, str, bytes]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue