summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_whichdb.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-06-14 08:16:34 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-06-14 08:16:34 (GMT)
commit17fb50790dfb662c05b073fdc44861ca0a735533 (patch)
treef17cf6763ead317e9263c2142799ff829f32e481 /Lib/test/test_whichdb.py
parent8316feb155c3db0114259eab86a7a19cf345cd2e (diff)
downloadcpython-17fb50790dfb662c05b073fdc44861ca0a735533.zip
cpython-17fb50790dfb662c05b073fdc44861ca0a735533.tar.gz
cpython-17fb50790dfb662c05b073fdc44861ca0a735533.tar.bz2
Treat empty dat/dir pairs as dumbdbm. Fixes #744687.
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))