def METHOD_NAME(self):
    # Try to open a non-existent database.
    unlink(filename)
    self.assertRaises(gdbm.error, gdbm.open, filename, 'r')
    # Try to access a closed database.
    self.g = gdbm.open(filename, 'c')
    self.g.close()
    self.assertRaises(gdbm.error, lambda: self.g['a'])
    # try pass an invalid open flag
    self.assertRaises(gdbm.error, lambda: gdbm.open(filename, 'rx').close())