Skip to content

Commit a309ad9

Browse files
authored
gh-98513: Test abstract methods of some collections types (#98516)
1 parent c32bc1b commit a309ad9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Lib/test/test_collections.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,8 @@ def throw(self, typ, val=None, tb=None):
810810
def __await__(self):
811811
yield
812812

813+
self.validate_abstract_methods(Awaitable, '__await__')
814+
813815
non_samples = [None, int(), gen(), object()]
814816
for x in non_samples:
815817
self.assertNotIsInstance(x, Awaitable)
@@ -860,6 +862,8 @@ def throw(self, typ, val=None, tb=None):
860862
def __await__(self):
861863
yield
862864

865+
self.validate_abstract_methods(Coroutine, '__await__', 'send', 'throw')
866+
863867
non_samples = [None, int(), gen(), object(), Bar()]
864868
for x in non_samples:
865869
self.assertNotIsInstance(x, Coroutine)
@@ -1943,6 +1947,7 @@ def test_ByteString(self):
19431947
self.assertFalse(issubclass(sample, ByteString))
19441948
self.assertNotIsInstance(memoryview(b""), ByteString)
19451949
self.assertFalse(issubclass(memoryview, ByteString))
1950+
self.validate_abstract_methods(ByteString, '__getitem__', '__len__')
19461951

19471952
def test_MutableSequence(self):
19481953
for sample in [tuple, str, bytes]:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy