summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-11-03 02:33:01 (GMT)
committerGitHub <noreply@github.com>2022-11-03 02:33:01 (GMT)
commit27dc6dbafeb26ce2c5141121debd825f7666aa53 (patch)
tree45942a1700c7f7fc1fceade4586711ab2e72a247
parentb9e621b9f41ec80cc8d9e721fe3c03d69bf1ee9f (diff)
downloadcpython-27dc6dbafeb26ce2c5141121debd825f7666aa53.zip
cpython-27dc6dbafeb26ce2c5141121debd825f7666aa53.tar.gz
cpython-27dc6dbafeb26ce2c5141121debd825f7666aa53.tar.bz2
gh-98512: Add more tests for `ValuesView` (GH-98515)
(cherry picked from commit 29e027c3e6535aa1c0eacc2fb2002c53405e1f6f) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
-rw-r--r--Lib/test/test_collections.py3
-rw-r--r--Lib/test/test_dictviews.py3
2 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 3404b8a..17afda4 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -1580,6 +1580,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:
@@ -1843,6 +1844,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)
diff --git a/Lib/test/test_dictviews.py b/Lib/test/test_dictviews.py
index be271be..dae9374 100644
--- a/Lib/test/test_dictviews.py
+++ b/Lib/test/test_dictviews.py
@@ -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)