]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-98512: Add more tests for `ValuesView` (GH-98515)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 3 Nov 2022 02:35:39 +0000 (19:35 -0700)
committerGitHub <noreply@github.com>
Thu, 3 Nov 2022 02:35:39 +0000 (19:35 -0700)
(cherry picked from commit 29e027c3e6535aa1c0eacc2fb2002c53405e1f6f)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Lib/test/test_collections.py
Lib/test/test_dictviews.py

index fa1d0e014dee923f0f3539a31375b95db9225f1f..db7f9e7beb3ee1fd82fb751d99fd54fed9e0d36d 100644 (file)
@@ -1594,6 +1594,7 @@ class TestCollectionABCs(ABCTestCase):
         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 @@ class TestCollectionABCs(ABCTestCase):
         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)
 
index be271bebaaf1fffe1d955f4cfa817b2af650c795..dae93740d46c7c86c58cab7b46b674c93b4876ba 100644 (file)
@@ -320,6 +320,9 @@ class DictSetTest(unittest.TestCase):
         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)