diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2006-12-22 15:04:45 +0000 |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2006-12-22 15:04:45 +0000 |
commit | dc26758ffeb33f6d59cb30b0019da9252e0cea1c (patch) | |
tree | f844652e4abd60408be98492015b995f1bee553f /Lib/test/test_dumbdbm.py | |
parent | b29069d6b64e119f97ca860433e74d8dc2eb3707 (diff) | |
download | cpython-git-dc26758ffeb33f6d59cb30b0019da9252e0cea1c.tar.gz |
[Bug #802128] Make the mode argument of dumbdbm actually work the way it's
described, and add a test for it.
2.5 bugfix candidate, maybe; arguably this patch changes the API of
dumbdbm and shouldn't be added in a point-release.
Diffstat (limited to 'Lib/test/test_dumbdbm.py')
-rw-r--r-- | Lib/test/test_dumbdbm.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_dumbdbm.py b/Lib/test/test_dumbdbm.py index 63b14b011b..a1e34da34b 100644 --- a/Lib/test/test_dumbdbm.py +++ b/Lib/test/test_dumbdbm.py @@ -38,6 +38,20 @@ class DumbDBMTestCase(unittest.TestCase): self.read_helper(f) f.close() + def test_dumbdbm_creation_mode(self): + # On platforms without chmod, don't do anything. + if not hasattr(os, 'chmod'): + return + + f = dumbdbm.open(_fname, 'c', 0632) + f.close() + + import stat + st = os.stat(_fname + '.dat') + self.assertEqual(stat.S_IMODE(st.st_mode), 0632) + st = os.stat(_fname + '.dir') + self.assertEqual(stat.S_IMODE(st.st_mode), 0632) + def test_close_twice(self): f = dumbdbm.open(_fname) f['a'] = 'b' |