From 29e027c3e6535aa1c0eacc2fb2002c53405e1f6f Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Thu, 3 Nov 2022 05:10:42 +0300 Subject: gh-98512: Add more tests for `ValuesView` (#98515) --- Lib/test/test_collections.py | 3 +++ Lib/test/test_dictviews.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 1e398d6..35ba5e9 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -1602,6 +1602,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: @@ -1865,6 +1866,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 7c48d80..924f4a6 100644 --- a/Lib/test/test_dictviews.py +++ b/Lib/test/test_dictviews.py @@ -338,6 +338,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) -- cgit v0.12