Skip to content

Commit

Permalink
gh-98513: Test abstract methods of some collections types (#98516)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Nov 8, 2022
1 parent c32bc1b commit a309ad9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Lib/test/test_collections.py
Expand Up @@ -810,6 +810,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)
Expand Down Expand Up @@ -860,6 +862,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)
Expand Down Expand Up @@ -1943,6 +1947,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]:
Expand Down

0 comments on commit a309ad9

Please sign in to comment.