summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_dbm.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_dbm.py b/Lib/test/test_dbm.py
index 74c9c44..26d4c14 100644
--- a/Lib/test/test_dbm.py
+++ b/Lib/test/test_dbm.py
@@ -70,6 +70,14 @@ class AnyDBMTestCase(unittest.TestCase):
self.read_helper(f)
f.close()
+ def test_anydbm_creation_n_file_exists_with_invalid_contents(self):
+ with open(_fname, "w") as w:
+ pass # create an empty file
+
+ f = dbm.open(_fname, 'n')
+ self.addCleanup(f.close)
+ self.assertEqual(len(f), 0)
+
def test_anydbm_modification(self):
self.init_db()
f = dbm.open(_fname, 'c')