Lines Matching refs:calendar
1 import calendar
199 self.normalize_calendar(calendar.calendar(2004)),
205 calendar.TextCalendar().formatyear(2004).strip(),
211 calendar.HTMLCalendar().formatyearpage(2004).strip(),
222 self.assertEqual(calendar.isleap(2000), 1)
223 self.assertEqual(calendar.isleap(2001), 0)
224 self.assertEqual(calendar.isleap(2002), 0)
225 self.assertEqual(calendar.isleap(2003), 0)
228 self.assertRaises(ValueError, calendar.setfirstweekday, 'flabber')
229 self.assertRaises(ValueError, calendar.setfirstweekday, -1)
230 self.assertRaises(ValueError, calendar.setfirstweekday, 200)
231 orig = calendar.firstweekday()
232 calendar.setfirstweekday(calendar.SUNDAY)
233 self.assertEqual(calendar.firstweekday(), calendar.SUNDAY)
234 calendar.setfirstweekday(calendar.MONDAY)
235 self.assertEqual(calendar.firstweekday(), calendar.MONDAY)
236 calendar.setfirstweekday(orig)
239 self.assertRaises(IndexError, calendar.day_abbr.__getitem__, -10)
240 self.assertRaises(IndexError, calendar.day_name.__getitem__, 10)
241 self.assertEqual(len([d for d in calendar.day_abbr]), 7)
245 value = getattr(calendar, attr)
255 value = getattr(calendar, attr)
267 old_october = calendar.TextCalendar().formatmonthname(2010, 10, 10)
269 cal = calendar.LocaleTextCalendar(locale='')
280 cal = calendar.LocaleHTMLCalendar(locale='')
286 new_october = calendar.TextCalendar().formatmonthname(2010, 10, 10)
292 list(calendar.Calendar().itermonthdates(datetime.MAXYEAR, 12))
296 cal = calendar.Calendar(firstweekday)
302 cal = calendar.Calendar(firstweekday=3)
308 cal = calendar.Calendar(firstweekday)
318 self.oldfirstweekday = calendar.firstweekday()
319 calendar.setfirstweekday(self.firstweekday)
322 calendar.setfirstweekday(self.oldfirstweekday)
325 cal = calendar.monthcalendar(year, month)
332 firstweekday = calendar.MONDAY
390 firstweekday = calendar.SUNDAY
450 self.assertEqual(calendar.monthrange(2004,1), (3,31))
454 self.assertEqual(calendar.monthrange(2004,2), (6,29))
458 self.assertEqual(calendar.monthrange(2010,2), (0,28))
462 self.assertEqual(calendar.monthrange(2004,12), (2,31))
466 with self.assertRaises(calendar.IllegalMonthError):
467 calendar.monthrange(2004, 0)
471 with self.assertRaises(calendar.IllegalMonthError):
472 calendar.monthrange(2004, 13)
477 self.assertEqual(calendar.leapdays(2010,2010), 0)
481 self.assertEqual(calendar.leapdays(2010,2011), 0)
485 self.assertEqual(calendar.leapdays(2010,2012), 0)
489 self.assertEqual(calendar.leapdays(2012,2013), 1)
492 self.assertEqual(calendar.leapdays(1997,2020), 5)