def METHOD_NAME(self):
    for mode in ['r', 'rw', 'w', 'n']:
        try:
            self.d = dbm.ndbm.open(self.filename, mode)
            self.d.close()
        except error:
            self.fail()