Beispiel #1
0
 def test_is_summer_term(self):
     self.assertTrue(is_a_term("A-term"))
     self.assertTrue(is_b_term("B-term"))
     self.assertTrue(is_half_summer_term("A-term"))
     self.assertTrue(is_half_summer_term("B-term"))
     self.assertFalse(is_half_summer_term("Full-term"))
     self.assertTrue(is_full_summer_term("Full-term"))
     self.assertTrue(is_same_summer_term("A-term", "a-term"))
     self.assertFalse(is_same_summer_term("A-term", "Full-term"))
Beispiel #2
0
def filter_schedule_sections_by_summer_term(schedule, summer_term):
    """
    Filter the schedule sections by the give summer_term.
    """
    if (has_summer_quarter_section(schedule) and
            is_half_summer_term(summer_term)):
        filtered_sections = []
        for section in schedule.sections:
            if (is_full_summer_term(section.summer_term) or
                    is_same_summer_term(section.summer_term, summer_term)):
                filtered_sections.append(section)
        schedule.sections = filtered_sections