Skip to content

Commit 1add239

Browse files
[3.11] gh-98513: Test abstract methods of some collections types (GH-98516) (#99226)
(cherry picked from commit a309ad9) Co-authored-by: Nikita Sobolev <[email protected]>
1 parent 42fb233 commit 1add239

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
@@ -802,6 +802,8 @@ def throw(self, typ, val=None, tb=None):
802802
def __await__(self):
803803
yield
804804

805+
self.validate_abstract_methods(Awaitable, '__await__')
806+
805807
non_samples = [None, int(), gen(), object()]
806808
for x in non_samples:
807809
self.assertNotIsInstance(x, Awaitable)
@@ -852,6 +854,8 @@ def throw(self, typ, val=None, tb=None):
852854
def __await__(self):
853855
yield
854856

857+
self.validate_abstract_methods(Coroutine, '__await__', 'send', 'throw')
858+
855859
non_samples = [None, int(), gen(), object(), Bar()]
856860
for x in non_samples:
857861
self.assertNotIsInstance(x, Coroutine)
@@ -1935,6 +1939,7 @@ def test_ByteString(self):
19351939
self.assertFalse(issubclass(sample, ByteString))
19361940
self.assertNotIsInstance(memoryview(b""), ByteString)
19371941
self.assertFalse(issubclass(memoryview, ByteString))
1942+
self.validate_abstract_methods(ByteString, '__getitem__', '__len__')
19381943

19391944
def test_MutableSequence(self):
19401945
for sample in [tuple, str, bytes]:

0 commit comments

Comments
 (0)