def test_multiple_courses_some_conflict(self): self.maxDiff = None c1 = Course('C1', 3, {1, 2}) c2 = Course('C2', 4, {2, 3}) c3 = Course('C3', 3, {3, 4}) c4 = Course('C4', 4, {7, 8}) self.assertEqual([{c1, c3, c4}, {c2}], course_groups([c1, c2, c3, c4]))
def test_lectures_not_distinct(self): self.assertFalse( distinct_students( [Course('English', 3, {1, 2}), Course('Maths', 3, {3, 4})], Course('French', 4, {3, 6})))
def test_single_lecture_not_distinct(self): self.assertFalse( distinct_students([Course('English', 3, {1, 2})], Course('French', 4, {2, 6})))
def test_two_courses_conflict(self): self.maxDiff = None c1 = Course('English', 3, {1, 2}) c2 = Course('French', 4, {2, 3}) self.assertEqual([{c1}, {c2}], course_groups([c1, c2]))
def test_two_courses_no_conflict(self): self.maxDiff = None c1 = Course('English', 3, set()) c2 = Course('French', 4, set()) self.assertEqual([{c1, c2}], course_groups([c1, c2]))
def test_single_course(self): self.maxDiff = None c = Course('English 101', 3, set()) self.assertEqual([{c}], list(course_groups([c])))