MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_mutable_entry

Method test_mutable_entry

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

assertEqualMethod · 0.95
byteskeydictClass · 0.85
lenFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected