summaryrefslogtreecommitdiff
path: root/Lib/test/test_dbm_dumb.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-01-25 13:27:44 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2017-01-25 13:27:44 +0200
commit19b1c3b04e2b01bd3b35b9e14c1735959d3b65e8 (patch)
tree24ab2ab26f886e3da21f91979512412360abea5d /Lib/test/test_dbm_dumb.py
parent3f19a274c28567afb39ba46ea8a2ebdeab816b0b (diff)
parent82e2d87e841850bc39db8ae954321986761492f5 (diff)
downloadcpython-19b1c3b04e2b01bd3b35b9e14c1735959d3b65e8.tar.gz
Issue #27867: Function PySlice_GetIndicesEx() is deprecated and replaced with
a macro if Py_LIMITED_API is not set or set to the value between 0x03050400 and 0x03060000 (not including) or 0x03060100 or higher. Added functions PySlice_Unpack() and PySlice_AdjustIndices().
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,