mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Issue #9626: Fix views in collections.OrderedDict().
This commit is contained in:
parent
d9ed62cde3
commit
a54b2dac90
3 changed files with 22 additions and 0 deletions
|
|
@ -933,6 +933,12 @@ class TestOrderedDict(unittest.TestCase):
|
|||
od['a'] = 1
|
||||
self.assertEqual(list(od.items()), [('b', 2), ('a', 1)])
|
||||
|
||||
def test_views(self):
|
||||
s = 'the quick brown fox jumped over a lazy dog yesterday before dawn'.split()
|
||||
od = OrderedDict.fromkeys(s)
|
||||
self.assertEqual(list(od.viewkeys()), s)
|
||||
self.assertEqual(list(od.viewvalues()), [None for k in s])
|
||||
self.assertEqual(list(od.viewitems()), [(k, None) for k in s])
|
||||
|
||||
|
||||
class GeneralMappingTests(mapping_tests.BasicTestMappingProtocol):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue