summaryrefslogtreecommitdiff
path: root/Lib/test/test_dbm_dumb.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_dbm_dumb.py')
-rw-r--r--Lib/test/test_dbm_dumb.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/Lib/test/test_dbm_dumb.py b/Lib/test/test_dbm_dumb.py
index df531d64e4..73f2a32a7b 100644
--- a/Lib/test/test_dbm_dumb.py
+++ b/Lib/test/test_dbm_dumb.py
@@ -7,7 +7,6 @@ import operator
import os
import stat
import unittest
-import warnings
import dbm.dumb as dumbdbm
from test import support
from functools import partial
@@ -252,6 +251,20 @@ class DumbDBMTestCase(unittest.TestCase):
f = dumbdbm.open(_fname, value)
f.close()
+ def test_missing_index(self):
+ with dumbdbm.open(_fname, 'n') as f:
+ pass
+ os.unlink(_fname + '.dir')
+ for value in ('r', 'w'):
+ with self.assertWarnsRegex(DeprecationWarning,
+ "The index file is missing, the "
+ "semantics of the 'c' flag will "
+ "be used."):
+ f = dumbdbm.open(_fname, value)
+ f.close()
+ self.assertEqual(os.path.exists(_fname + '.dir'), value == 'w')
+ self.assertFalse(os.path.exists(_fname + '.bak'))
+
def test_invalid_flag(self):
for flag in ('x', 'rf', None):
with self.assertWarnsRegex(DeprecationWarning,