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])
def test_repr_recursive(self): # See issue #9826 od = OrderedDict.fromkeys('abc') od['x'] = od self.assertEqual( repr(od), "OrderedDict([('a', None), ('b', None), ('c', None), ('x', ...)])")
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])
def test_repr_recursive(self): # See issue #9826 od = OrderedDict.fromkeys("abc") od["x"] = od self.assertEqual(repr(od), "OrderedDict([('a', None), ('b', None), ('c', None), ('x', ...)])")