diff options
| author | R. David Murray <rdmurray@bitdance.com> | 2010-02-11 01:38:42 (GMT) |
|---|---|---|
| committer | R. David Murray <rdmurray@bitdance.com> | 2010-02-11 01:38:42 (GMT) |
| commit | 7c29f071d52f9b666974d40cc061b4ea03439d1e (patch) | |
| tree | fb6230b1d45671f3fd7ce2f2f23d4c56b6d361f9 /Lib/test/test_shelve.py | |
| parent | 63e4fd7eef8d2da09634e9416dd29fc28d8b8620 (diff) | |
| download | cpython-7c29f071d52f9b666974d40cc061b4ea03439d1e.zip cpython-7c29f071d52f9b666974d40cc061b4ea03439d1e.tar.gz cpython-7c29f071d52f9b666974d40cc061b4ea03439d1e.tar.bz2 | |
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.
Diffstat (limited to 'Lib/test/test_shelve.py')
| -rw-r--r-- | Lib/test/test_shelve.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_shelve.py b/Lib/test/test_shelve.py index 3b20281..df56625 100644 --- a/Lib/test/test_shelve.py +++ b/Lib/test/test_shelve.py @@ -90,6 +90,17 @@ class TestCase(unittest.TestCase): self.assertEqual(len(d1), 1) self.assertEqual(len(d2), 1) + def test_writeback_also_writes_immediately(self): + # Issue 5754 + d = {} + s = shelve.Shelf(d, writeback=True) + s['key'] = [1] + p1 = d['key'] # Will give a KeyError if backing store not updated + s['key'].append(2) + s.close() + p2 = d['key'] + self.assertNotEqual(p1, p2) # Write creates new object in store + from test import mapping_tests |
