def test_reconnect(self): # test the reconnect with not connected grn = Groonga() ctx = grn._ctx self.assertRaises(GroongaError, grn.reconnect) self.assertIs(grn._ctx, ctx) self.assertFalse(grn.connected) # test the reconnect grn = Groonga() ctx = grn._ctx grn.host = 'localhost' grn.port = 10041 grn.reconnect() self.assertIsNot(grn._ctx, ctx) self.assertTrue(grn.connected)