Skip to content

Commit 29e027c

Browse files
authored
gh-98512: Add more tests for ValuesView (#98515)
1 parent 1fd20d0 commit 29e027c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Lib/test/test_collections.py

+3
Original file line numberDiff line numberDiff line change
@@ -1602,6 +1602,7 @@ def __len__(self):
16021602
containers = [
16031603
seq,
16041604
ItemsView({1: nan, 2: obj}),
1605+
KeysView({1: nan, 2: obj}),
16051606
ValuesView({1: nan, 2: obj})
16061607
]
16071608
for container in containers:
@@ -1865,6 +1866,8 @@ def test_MutableMapping_subclass(self):
18651866
mymap['red'] = 5
18661867
self.assertIsInstance(mymap.keys(), Set)
18671868
self.assertIsInstance(mymap.keys(), KeysView)
1869+
self.assertIsInstance(mymap.values(), Collection)
1870+
self.assertIsInstance(mymap.values(), ValuesView)
18681871
self.assertIsInstance(mymap.items(), Set)
18691872
self.assertIsInstance(mymap.items(), ItemsView)
18701873

Lib/test/test_dictviews.py

+3
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ def test_abc_registry(self):
338338
self.assertIsInstance(d.values(), collections.abc.ValuesView)
339339
self.assertIsInstance(d.values(), collections.abc.MappingView)
340340
self.assertIsInstance(d.values(), collections.abc.Sized)
341+
self.assertIsInstance(d.values(), collections.abc.Collection)
342+
self.assertIsInstance(d.values(), collections.abc.Iterable)
343+
self.assertIsInstance(d.values(), collections.abc.Container)
341344

342345
self.assertIsInstance(d.items(), collections.abc.ItemsView)
343346
self.assertIsInstance(d.items(), collections.abc.MappingView)

0 commit comments

Comments
 (0)