本文整理匯總了Python中schedule.periods.Month.get_occurrences方法的典型用法代碼示例。如果您正苦於以下問題:Python Month.get_occurrences方法的具體用法?Python Month.get_occurrences怎麽用?Python Month.get_occurrences使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類schedule.periods.Month
的用法示例。
在下文中一共展示了Month.get_occurrences方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_get_values
# 需要導入模塊: from schedule.periods import Month [as 別名]
# 或者: from schedule.periods.Month import get_occurrences [as 別名]
def test_get_values(self):
self.client.login(username='admin', password='pa55w0rd')
date = datetime.datetime(2015, 6, 1)
resp = self.client.get(reverse('admin:monthly_schedule', kwargs={'year': date.year, 'month': date.month}))
formset = resp.context['formset']
self.assertEqual(len(formset), Barber.objects.all().count())
for form, barber in zip(formset, Barber.objects.all()):
month = Month(self.calendar.events.get_for_object(barber), date=date)
self.assertEqual(len(form.visible_fields()), len(list(month.get_days())))
self.assertEqual(len(form.changed_data), len(month.get_occurrences()))
for day, occ in zip(form.changed_data, month.cached_get_sorted_occurrences()):
self.assertEqual(int(day[4:]), occ.end.day)