def all_available_periods(self, student, internship, periods): student_affectations = self.get_student_affectations( student, self.affectations) unavailable_periods = self.get_periods_from_affectations( student_affectations) available_periods = difference(periods, unavailable_periods) return available_periods
def all_available_periods(self, student, internship_length, periods): student_affectations = get_student_affectations( student, self.affectations) unavailable_periods = get_periods_from_affectations( student_affectations) available_periods = difference(periods, unavailable_periods) grouped_periods = list( group_periods_by_consecutives(available_periods, length=internship_length)) return grouped_periods
def student_empty_periods(self, student, affectations): student_affectations = get_student_affectations(student, affectations) unavailable_periods = get_periods_from_affectations( student_affectations) return difference(list(self.periods), unavailable_periods)
def test_difference_non_empty_lists(self): first_list = [1, 2, 3, 4, 5] second_list = [4, 5] expected = [1, 2, 3] self.assertEqual(expected, difference(first_list, second_list))
def test_difference_with_list_without_common_elements(self): first_list = [1, 2, 3, 4] second_list = [5, 6] expected = [1, 2, 3, 4] self.assertEqual(expected, difference(first_list, second_list))
def test_difference_with_empty_lists(self): first_list = [] second_list = [] expected = [] self.assertEqual(expected, difference(first_list, second_list))