def testSetChooseFile(self): me = "me" def chooseMe(prompt): return me rinterface.set_choosefile(chooseMe) self.assertEqual(rinterface.get_choosefile(), chooseMe) res = rinterface.baseenv["file.choose"]() self.assertEqual(me, res[0]) rinterface.set_choosefile(rinterface.chooseFile)