Beispiel #1
0
 def test_open(self):
     for e, t in tdbm._db_exts.items():
         path = os.path.join(tempfile.gettempdir(), "tmp_tdbm_test{0}".format(e))
         db = tdbm.open(path, "c")
         self.assertTrue(isinstance(db, t))
         db.close()
         os.remove(path)
Beispiel #2
0
 def test_whichdb(self):
     for e, t in tdbm._db_exts.items():
         path = os.path.join(tempfile.gettempdir(), "tmp_tdbm_test{0}".format(e))
         db = tdbm.open(path, "c")
         db.close()
         self.assertEqual(tdbm.whichdb(path), t)
         os.remove(path)
Beispiel #3
0
 def _open(self, flag):
     self.db = tdbm.open(self.path, flag)
Beispiel #4
0
 def test_open_default(self):
     path = os.path.join(tempfile.gettempdir(), "tmp_tdbm_test.db")
     db = tdbm.open(path, "c")
     self.assertTrue(isinstance(db, tdbm.TCHDB))
     db.close()
     os.remove(path)