def test_weekly_all_day_occurring_tomorrow(self): weekly_all_day = RecurringEntry("fakeId", "Weekly All Day", "", REMIND, LOCATION, UPDATED, weekly_recurrence_all_day, self.cal) time = datetime(2006, 6, 5, tzinfo=TZ) events = weekly_all_day.get_events_occurring_on(time - timedelta(days=1)) self.assertEquals(0, len(events))
def test_weekly_all_day_occuring_today(self): """ Test an all-day event is returned for a call to occuring on. """ weekly_all_day = RecurringEntry("fakeId", "Weekly All Day", "", REMIND, LOCATION, UPDATED, weekly_recurrence_all_day, self.cal) time = datetime(2006, 6, 5, tzinfo=TZ) events = weekly_all_day.get_events_occurring_on(time) self.assertEquals(1, len(events))
def test_daily_recurring_entry_for_one_week(self): daily_for_one_week = RecurringEntry("fakeId", "Daily For One Week", "", REMIND, LOCATION, UPDATED, daily_recurrence_for_one_week, self.cal) self.assertEqual(3600, daily_for_one_week.duration) self.assertEqual(LOCATION, daily_for_one_week.location) start_date = datetime(2006, 6, 1, tzinfo=TZ) end_date = datetime(2006, 6, 30, tzinfo=TZ) events = daily_for_one_week.get_events_starting_between(start_date, end_date) self.assertEquals(5, len(events)) events = daily_for_one_week.get_events_occurring_on( datetime(2006, 6, 9, tzinfo=TZ)) self.assertEquals(1, len(events))
def test_weekly_all_day_recurrence(self): weekly_all_day = RecurringEntry("fakeId", "Weekly All Day", "", REMIND, LOCATION, UPDATED, weekly_recurrence_all_day, self.cal) self.assertEqual(86400, weekly_all_day.duration) # Event starts on June 5th 2006 start_date = datetime(2006, 5, 28, tzinfo=TZ) end_date = datetime(2006, 6, 30, tzinfo=TZ) events = weekly_all_day.get_events_starting_between(start_date, end_date) self.assertEquals(4, len(events)) self.assertEquals(2006, events[0].time.year) self.assertEquals(6, events[0].time.month) self.assertEquals(5, events[0].time.day) self.assertEquals(6, events[1].time.month) self.assertEquals(12, events[1].time.day) self.assertEquals(6, events[2].time.month) self.assertEquals(19, events[2].time.day) self.assertEquals(6, events[3].time.month) self.assertEquals(26, events[3].time.day)
def test_weekly_tv_show(self): entry = RecurringEntry("fakeId", "CSI", "", REMIND, LOCATION, UPDATED, weekly_tv_show, self.cal) events = entry.get_events_occurring_on( datetime(2006,11, 16, tzinfo=TZ)) self.assertEquals(1, len(events))
def __multi_day_tester(self, query_date, expected): # monthly_multi_day = 25-27th of every month (starting Oct 06): entry = RecurringEntry("fakeId", "Montly Multi-Day", "", REMIND, LOCATION, UPDATED, monthly_multi_day, self.cal) events = entry.get_events_occurring_on(query_date) self.assertEquals(expected, len(events))