def test_student() -> None: student_1 = Student(1, "roney") student_2 = Student(2, "tim") student_3 = Student(3, "allen") assert str(student_1) == "roney" assert str(student_2) == "tim" assert str(student_3) != "roney" assert student_1.id == 1 assert student_2.id != 4 assert student_3.id == 3 mcq_1 = MultipleChoiceQuestion(1, "Cities in Canada", ["Toronto", "Ottawa", "Vancouver"]) mcq_2 = MultipleChoiceQuestion(2, "C", ["A", "O", "V"]) mcq_1_ans = Answer("Toronto") student_1.set_answer(mcq_1, mcq_1_ans) assert student_1.has_answer(mcq_1) assert not student_1.has_answer(mcq_2) assert student_1.get_answer(mcq_1) == mcq_1_ans assert student_1.get_answer(mcq_2) == None assert student_2.get_answer(mcq_1) == None
def test_student_has_answer() -> None: """A test for has_answer() in class Student.""" s = Student(123, 'Mike') que = Question(2, 'F') assert s.has_answer(que) is False