Treat empty dat/dir pairs as dumbdbm. Fixes #744687.

This commit is contained in:
Martin v. Löwis 2003-06-14 08:16:34 +00:00
parent 8316feb155
commit 17fb50790d
2 changed files with 12 additions and 3 deletions

View file

@ -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))