def test_can_return_week(self): m = Month(2012, 10) w = Week() w.set_day(0, TimeRange(Time(7), Time(17))) m.add_week(40, w) self.assertEquals( m.get_week(40).get_day(0), TimeRange(Time(7), Time(17)))
def test_can_return_half_week(self): m = Month(2012, 11) w = Week() w.set_day(2, TimeRange(Time(7), Time(17))) w.set_day(3, TimeRange(Time(8), Time(18))) m.add_week(44, w) self.assertEquals(m.get_week(44).get_day(2), None)
def test_returns_correctly_annotated_week_for_start_of_month(self): m = Month(2012, 11) w = Week() for i in xrange(7): w.set_day(i, TimeRange(Time(7), Time(17))) m.add_week(44, w) aw = m.get_week(44) self.assertEquals(aw.get_earliest_day_in_month(), 1) self.assertEquals(aw.get_first_valid_day(), 3) self.assertEquals(aw.get_last_valid_day(), 6)
def test_returns_annotated_weeks(self): m = Month(2012, 10) w = Week() w.set_day(0, TimeRange(Time(7), Time(17))) m.add_week(40, w) self.assertEquals(type(m.get_week(40)), AnnotatedWeek)
def test_can_return_week(self): m = Month(2012, 10) w = Week() w.set_day(0, TimeRange(Time(7), Time(17))) m.add_week(40, w) self.assertEquals(m.get_week(40).get_day(0), TimeRange(Time(7), Time(17)))