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

Method test_writeback_also_writes_immediately

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

Source from the content-addressed store, hash-verified

137 self.assertRaises(UnicodeEncodeError, s.__setitem__, key, [1])
138
139 def test_writeback_also_writes_immediately(self):
140 # Issue 5754
141 d = {}
142 key = 'key'
143 encodedkey = key.encode('utf-8')
144 with shelve.Shelf(d, writeback=True) as s:
145 s[key] = [1]
146 p1 = d[encodedkey] # Will give a KeyError if backing store not updated
147 s['key'].append(2)
148 p2 = d[encodedkey]
149 self.assertNotEqual(p1, p2) # Write creates new object in store
150
151 def test_with(self):
152 d1 = {}

Callers

nothing calls this directly

Calls 3

assertNotEqualMethod · 0.95
encodeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected