[Python-checkins] [3.11] gh-98513: Test abstract methods of some `collections` types (GH-98516) (#99226)

JelleZijlstra webhook-mailer at python.org
Mon Nov 7 21:45:14 EST 2022


https://github.com/python/cpython/commit/1add2393a87ef036b90b59b6a2a342b7f56646ff
commit: 1add2393a87ef036b90b59b6a2a342b7f56646ff
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: JelleZijlstra <jelle.zijlstra at gmail.com>
date: 2022-11-07T18:45:08-08:00
summary:

[3.11] gh-98513: Test abstract methods of some `collections` types (GH-98516) (#99226)

(cherry picked from commit a309ad9f76db4ab9a8f933ab1ffea78ecaca827f)

Co-authored-by: Nikita Sobolev <mail at sobolevn.me>

files:
M Lib/test/test_collections.py

diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index db7f9e7beb3e..5da446a13da4 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -802,6 +802,8 @@ def throw(self, typ, val=None, tb=None):
             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)
@@ -852,6 +854,8 @@ def throw(self, typ, val=None, tb=None):
             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)
@@ -1935,6 +1939,7 @@ def test_ByteString(self):
             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]:



More information about the Python-checkins mailing list