def testSetReadConsole(self): yes = "yes\n" def sayyes(prompt): return yes rinterface.set_readconsole(sayyes) self.assertEqual(rinterface.get_readconsole(), sayyes) res = rinterface.baseenv["readline"]() self.assertEqual(yes.strip(), res[0]) rinterface.set_readconsole(rinterface.consoleRead)