mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Merged revisions 78145 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r78145 | r.david.murray | 2010-02-10 21:42:19 -0500 (Wed, 10 Feb 2010) | 18 lines Merged revisions 78141-78142 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r78141 | r.david.murray | 2010-02-10 20:38:42 -0500 (Wed, 10 Feb 2010) | 6 lines Issue 5754: tweak shelve doc wording to make it clearer that even when writeback=True values are written to the backing store when assigned to the shelf. Add test to confirm that this happens. Doc patch and added test by Robert Lehmann. I also fixed the cross references to the sync and close methods. ........ r78142 | r.david.murray | 2010-02-10 20:56:42 -0500 (Wed, 10 Feb 2010) | 3 lines Improve issue 7835 fix per MAL to handle the case that the module dictionary has also been cleared. ........ ................
This commit is contained in:
parent
709b4c35cc
commit
733ecdcc2f
3 changed files with 27 additions and 12 deletions
|
@ -122,6 +122,19 @@ class TestCase(unittest.TestCase):
|
|||
self.assertEqual(len(d1), 1)
|
||||
self.assertEqual(len(d2), 1)
|
||||
|
||||
def test_writeback_also_writes_immediately(self):
|
||||
# Issue 5754
|
||||
d = {}
|
||||
key = 'key'
|
||||
encodedkey = key.encode('utf-8')
|
||||
s = shelve.Shelf(d, writeback=True)
|
||||
s[key] = [1]
|
||||
p1 = d[encodedkey] # Will give a KeyError if backing store not updated
|
||||
s['key'].append(2)
|
||||
s.close()
|
||||
p2 = d[encodedkey]
|
||||
self.assertNotEqual(p1, p2) # Write creates new object in store
|
||||
|
||||
|
||||
from test import mapping_tests
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue