summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2022-11-08 01:48:23 (GMT)
committerGitHub <noreply@github.com>2022-11-08 01:48:23 (GMT)
commita309ad9f76db4ab9a8f933ab1ffea78ecaca827f (patch)
tree51c56002e37f293120789d12840daae298f54ec2
parentc32bc1bffd9d63ede0d0505abab983247a3ad0c6 (diff)
downloadcpython-a309ad9f76db4ab9a8f933ab1ffea78ecaca827f.zip
cpython-a309ad9f76db4ab9a8f933ab1ffea78ecaca827f.tar.gz
cpython-a309ad9f76db4ab9a8f933ab1ffea78ecaca827f.tar.bz2
gh-98513: Test abstract methods of some `collections` types (#98516)
-rw-r--r--Lib/test/test_collections.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 35ba5e9..bfe18c7 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]: