diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-11-08 02:19:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-08 02:19:33 (GMT) |
commit | a5d3e1dd04bdf12b6b16eca910b7446270d67c0e (patch) | |
tree | 882920b29502edab0f5fba52c6deb2cf6835f7b8 | |
parent | d2cb0f91178ed97e3a7509f7d5fca50a39880c3d (diff) | |
download | cpython-a5d3e1dd04bdf12b6b16eca910b7446270d67c0e.zip cpython-a5d3e1dd04bdf12b6b16eca910b7446270d67c0e.tar.gz cpython-a5d3e1dd04bdf12b6b16eca910b7446270d67c0e.tar.bz2 |
gh-98513: Test abstract methods of some `collections` types (GH-98516)
(cherry picked from commit a309ad9f76db4ab9a8f933ab1ffea78ecaca827f)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
-rw-r--r-- | Lib/test/test_collections.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 17afda4..f5af55a 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -788,6 +788,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) @@ -838,6 +840,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) @@ -1921,6 +1925,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]: |