def test_question_checkAnswer_wrong(self): quest = 'q?' ans = [] ans.append(Answer('a', 1)) ans.append(Answer('b', 0)) ans.append(Answer('c', 0)) question = Question(quest, ans) res = question.checkAnswer('b') self.assertEqual(res, 0)
def test_question_checkAnswer_correct(self): quest = 'q?' ans = [] ans.append(Answer('a', 1)) ans.append(Answer('b', 0)) ans.append(Answer('c', 0)) question = Question(quest, ans) given_answer = 'a' res = question.checkAnswer(given_answer) self.assertEqual(res, 1)
def test_isCompleted(self): answer_1 = Answer("la prima", 1) answer_2 = Answer("la seconda") question = Question("Buona?", [answer_1, answer_2]) self.assertEqual(question.checkAnswer("la prima"), True)