From: Nikita Sobolev Date: Tue, 8 Nov 2022 01:48:23 +0000 (+0300) Subject: gh-98513: Test abstract methods of some `collections` types (#98516) X-Git-Tag: v3.12.0a2~82 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a309ad9f76db4ab9a8f933ab1ffea78ecaca827f;p=thirdparty%2FPython%2Fcpython.git gh-98513: Test abstract methods of some `collections` types (#98516) --- diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 35ba5e97528b..bfe18c7fc503 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -810,6 +810,8 @@ class TestOneTrickPonyABCs(ABCTestCase): 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) @@ -860,6 +862,8 @@ class TestOneTrickPonyABCs(ABCTestCase): 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) @@ -1943,6 +1947,7 @@ class TestCollectionABCs(ABCTestCase): 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]: