summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_whichdb.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_whichdb.py')
-rw-r--r--Lib/test/test_whichdb.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_whichdb.py b/Lib/test/test_whichdb.py
index 000c999..f2652c1 100644
--- a/Lib/test/test_whichdb.py
+++ b/Lib/test/test_whichdb.py
@@ -45,7 +45,12 @@ for name in anydbm._names:
def test_whichdb_name(self, name=name, mod=mod):
# Check whether whichdb correctly guesses module name
# for databases opened with module mod.
+ # Try with empty files first
f = mod.open(_fname, 'c')
+ f.close()
+ self.assertEqual(name, whichdb.whichdb(_fname))
+ # Now add a key
+ f = mod.open(_fname, 'w')
f["1"] = "1"
f.close()
self.assertEqual(name, whichdb.whichdb(_fname))