MCPcopy Create free account
hub / github.com/python/cpython / test_locale_text_calendar

Method test_locale_text_calendar

Lib/test/test_calendar.py:637–673  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

635 list(calendar.standalone_month_abbr))
636
637 def test_locale_text_calendar(self):
638 try:
639 cal = calendar.LocaleTextCalendar(locale='')
640 local_weekday = cal.formatweekday(1, 10)
641 local_weekday_abbr = cal.formatweekday(1, 3)
642 local_month = cal.formatmonthname(2010, 10, 10)
643 except locale.Error:
644 # cannot set the system default locale -- skip rest of test
645 raise unittest.SkipTest('cannot set the system default locale')
646 self.assertIsInstance(local_weekday, str)
647 self.assertIsInstance(local_weekday_abbr, str)
648 self.assertIsInstance(local_month, str)
649 self.assertEqual(len(local_weekday), 10)
650 self.assertEqual(len(local_weekday_abbr), 3)
651 self.assertGreaterEqual(len(local_month), 10)
652
653 cal = calendar.LocaleTextCalendar(locale=None)
654 local_weekday = cal.formatweekday(1, 10)
655 local_weekday_abbr = cal.formatweekday(1, 3)
656 local_month = cal.formatmonthname(2010, 10, 10)
657 self.assertIsInstance(local_weekday, str)
658 self.assertIsInstance(local_weekday_abbr, str)
659 self.assertIsInstance(local_month, str)
660 self.assertEqual(len(local_weekday), 10)
661 self.assertEqual(len(local_weekday_abbr), 3)
662 self.assertGreaterEqual(len(local_month), 10)
663
664 cal = calendar.LocaleTextCalendar(locale='C')
665 local_weekday = cal.formatweekday(1, 10)
666 local_weekday_abbr = cal.formatweekday(1, 3)
667 local_month = cal.formatmonthname(2010, 10, 10)
668 self.assertIsInstance(local_weekday, str)
669 self.assertIsInstance(local_weekday_abbr, str)
670 self.assertIsInstance(local_month, str)
671 self.assertEqual(len(local_weekday), 10)
672 self.assertEqual(len(local_weekday_abbr), 3)
673 self.assertGreaterEqual(len(local_month), 10)
674
675 def test_locale_html_calendar(self):
676 try:

Callers

nothing calls this directly

Calls 5

formatweekdayMethod · 0.95
formatmonthnameMethod · 0.95
assertIsInstanceMethod · 0.80
assertGreaterEqualMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected