[Python-checkins] gh-98512: Add more tests for `ValuesView` (GH-98515)

miss-islington webhook-mailer at python.org
Wed Nov 2 22:35:45 EDT 2022


https://github.com/python/cpython/commit/a02979fa48103a84f635ce06bd01d5437c39f60c
commit: a02979fa48103a84f635ce06bd01d5437c39f60c
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-11-02T19:35:39-07:00
summary:

gh-98512: Add more tests for `ValuesView` (GH-98515)

(cherry picked from commit 29e027c3e6535aa1c0eacc2fb2002c53405e1f6f)

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

files:
M Lib/test/test_collections.py
M Lib/test/test_dictviews.py

diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index fa1d0e014dee..db7f9e7beb3e 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -1594,6 +1594,7 @@ def __len__(self):
         containers = [
             seq,
             ItemsView({1: nan, 2: obj}),
+            KeysView({1: nan, 2: obj}),
             ValuesView({1: nan, 2: obj})
         ]
         for container in containers:
@@ -1857,6 +1858,8 @@ def test_MutableMapping_subclass(self):
         mymap['red'] = 5
         self.assertIsInstance(mymap.keys(), Set)
         self.assertIsInstance(mymap.keys(), KeysView)
+        self.assertIsInstance(mymap.values(), Collection)
+        self.assertIsInstance(mymap.values(), ValuesView)
         self.assertIsInstance(mymap.items(), Set)
         self.assertIsInstance(mymap.items(), ItemsView)
 
diff --git a/Lib/test/test_dictviews.py b/Lib/test/test_dictviews.py
index be271bebaaf1..dae93740d46c 100644
--- a/Lib/test/test_dictviews.py
+++ b/Lib/test/test_dictviews.py
@@ -320,6 +320,9 @@ def test_abc_registry(self):
         self.assertIsInstance(d.values(), collections.abc.ValuesView)
         self.assertIsInstance(d.values(), collections.abc.MappingView)
         self.assertIsInstance(d.values(), collections.abc.Sized)
+        self.assertIsInstance(d.values(), collections.abc.Collection)
+        self.assertIsInstance(d.values(), collections.abc.Iterable)
+        self.assertIsInstance(d.values(), collections.abc.Container)
 
         self.assertIsInstance(d.items(), collections.abc.ItemsView)
         self.assertIsInstance(d.items(), collections.abc.MappingView)



More information about the Python-checkins mailing list