mirror of https://github.com/python/cpython.git
gh-98512: Add more tests for `ValuesView` (GH-98515)
(cherry picked from commit 29e027c3e6
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
parent
2199a7dace
commit
a02979fa48
|
@ -1594,6 +1594,7 @@ def __len__(self):
|
||||||
containers = [
|
containers = [
|
||||||
seq,
|
seq,
|
||||||
ItemsView({1: nan, 2: obj}),
|
ItemsView({1: nan, 2: obj}),
|
||||||
|
KeysView({1: nan, 2: obj}),
|
||||||
ValuesView({1: nan, 2: obj})
|
ValuesView({1: nan, 2: obj})
|
||||||
]
|
]
|
||||||
for container in containers:
|
for container in containers:
|
||||||
|
@ -1857,6 +1858,8 @@ def test_MutableMapping_subclass(self):
|
||||||
mymap['red'] = 5
|
mymap['red'] = 5
|
||||||
self.assertIsInstance(mymap.keys(), Set)
|
self.assertIsInstance(mymap.keys(), Set)
|
||||||
self.assertIsInstance(mymap.keys(), KeysView)
|
self.assertIsInstance(mymap.keys(), KeysView)
|
||||||
|
self.assertIsInstance(mymap.values(), Collection)
|
||||||
|
self.assertIsInstance(mymap.values(), ValuesView)
|
||||||
self.assertIsInstance(mymap.items(), Set)
|
self.assertIsInstance(mymap.items(), Set)
|
||||||
self.assertIsInstance(mymap.items(), ItemsView)
|
self.assertIsInstance(mymap.items(), ItemsView)
|
||||||
|
|
||||||
|
|
|
@ -320,6 +320,9 @@ def test_abc_registry(self):
|
||||||
self.assertIsInstance(d.values(), collections.abc.ValuesView)
|
self.assertIsInstance(d.values(), collections.abc.ValuesView)
|
||||||
self.assertIsInstance(d.values(), collections.abc.MappingView)
|
self.assertIsInstance(d.values(), collections.abc.MappingView)
|
||||||
self.assertIsInstance(d.values(), collections.abc.Sized)
|
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.ItemsView)
|
||||||
self.assertIsInstance(d.items(), collections.abc.MappingView)
|
self.assertIsInstance(d.items(), collections.abc.MappingView)
|
||||||
|
|
Loading…
Reference in New Issue