本文整理汇总了Python中schedule.models.Calendar.occurrences_after方法的典型用法代码示例。如果您正苦于以下问题:Python Calendar.occurrences_after方法的具体用法?Python Calendar.occurrences_after怎么用?Python Calendar.occurrences_after使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类schedule.models.Calendar
的用法示例。
在下文中一共展示了Calendar.occurrences_after方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_occurrences_after_with_events_before_returns_empty
# 需要导入模块: from schedule.models import Calendar [as 别名]
# 或者: from schedule.models.Calendar import occurrences_after [as 别名]
def test_occurrences_after_with_events_before_returns_empty(self):
calendar = Calendar()
calendar.save()
start_after = timezone.now() + datetime.timedelta(days=-1)
end_after = start_after + datetime.timedelta(hours=1)
event = self.__create_event(start_after, end_after)
calendar.events.add(event)
occurrences = list(calendar.occurrences_after(timezone.now()))
self.assertEqual(occurrences, [])
示例2: test_occurrences_after_with_events_after_returns_events
# 需要导入模块: from schedule.models import Calendar [as 别名]
# 或者: from schedule.models.Calendar import occurrences_after [as 别名]
def test_occurrences_after_with_events_after_returns_events(self):
calendar = Calendar()
calendar.save()
start_after = timezone.now() + datetime.timedelta(days=1)
end_after = start_after + datetime.timedelta(hours=1)
event = self.__create_event(start_after, end_after)
calendar.events.add(event)
occurrences = list(calendar.occurrences_after(timezone.now()))
self.assertEquals(len(occurrences), 1)
self.assertEquals(occurrences[0].start, start_after)
self.assertEquals(occurrences[0].end, end_after)
示例3: test_occurrences_after_without_events_is_empty
# 需要导入模块: from schedule.models import Calendar [as 别名]
# 或者: from schedule.models.Calendar import occurrences_after [as 别名]
def test_occurrences_after_without_events_is_empty(self):
calendar = Calendar()
self.assertEqual(list(calendar.occurrences_after(timezone.now())), [])