MCPcopy Index your code
hub / github.com/python/cpython / test_mutable_entry

Method test_mutable_entry

Lib/test/test_shelve.py:108–124  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

106 self.assertNotEqual(d1.items(), d2.items())
107
108 def test_mutable_entry(self):
109 d1 = byteskeydict()
110 with shelve.Shelf(d1, protocol=2, writeback=False) as s:
111 s['key1'] = [1,2,3,4]
112 self.assertEqual(s['key1'], [1,2,3,4])
113 s['key1'].append(5)
114 self.assertEqual(s['key1'], [1,2,3,4])
115
116 d2 = byteskeydict()
117 with shelve.Shelf(d2, protocol=2, writeback=True) as s:
118 s['key1'] = [1,2,3,4]
119 self.assertEqual(s['key1'], [1,2,3,4])
120 s['key1'].append(5)
121 self.assertEqual(s['key1'], [1,2,3,4,5])
122
123 self.assertEqual(len(d1), 1)
124 self.assertEqual(len(d2), 1)
125
126 def test_keyencoding(self):
127 d = {}

Callers

nothing calls this directly

Calls 3

assertEqualMethod · 0.95
byteskeydictClass · 0.85
appendMethod · 0.45

Tested by

no test coverage detected