def test_course_all_answered() -> None: student_1 = Student(2, "Jane") student_2 = Student(1, "John") course = Course("math") course_2 = Course("Eng") lst = [student_1, student_2] lst_2 = [student_1] course.enroll_students(lst) course_2.enroll_students(lst_2) q = CheckboxQuestion(1, "choose", [1, 2, 3]) a1 = Answer([1]) a2 = Answer([5]) student_1.set_answer(q, a1) student_2.set_answer(q, a2) s = Survey([q]) assert course.all_answered(s) is False assert course_2.all_answered(s) is True
def test_course_all_answered() -> None: """A test for all_answered() in class Course.""" s1 = Student(1, 'A') s2 = Student(2, 'B') c = Course('CS') c.enroll_students([s1, s2]) q1 = YesNoQuestion(2, 'F') q2 = YesNoQuestion(3, 'K') a1 = Answer(True) a2 = Answer(False) survey = Survey([q1, q2]) s1.set_answer(q1, a1) s1.set_answer(q2, a2) s2.set_answer(q1, a1) s2.set_answer(q2, a2) assert c.all_answered(survey) is True