def test_learn(self): input1 = "glob is I" input2 = "glob glob Silver is 34 Credits" tars = TARS() tars.learn(input1) self.assertEquals(tars.get("NUMBERS", "glob"), "I") tars.learn(input2) self.assertEquals(tars.get("UNITS", "Silver"), 17)
def init_TARS(self): tars = TARS() with open("input.txt") as f: for line in f: not tars.is_question(line) and tars.learn(line) return tars