diff options
Diffstat (limited to 'Lib/test/test_calendar.py')
-rw-r--r-- | Lib/test/test_calendar.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py index eed96ef..2059eaf 100644 --- a/Lib/test/test_calendar.py +++ b/Lib/test/test_calendar.py @@ -31,6 +31,29 @@ class CalendarTestCase(unittest.TestCase): self.assertRaises(IndexError, calendar.day_name.__getitem__, 10) self.assertEqual(len([d for d in calendar.day_abbr]), 7) + def test_days(self): + for attr in "day_name", "day_abbr": + value = getattr(calendar, attr) + self.assertEqual(len(value), 7) + self.assertEqual(len(value[:]), 7) + # ensure they're all unique + d = {} + for v in value: + d[v] = 1 + self.assertEqual(len(d), 7) + + def test_months(self): + for attr in "month_name", "month_abbr": + value = getattr(calendar, attr) + self.assertEqual(len(value), 13) + self.assertEqual(len(value[:]), 13) + self.assertEqual(value[0], "") + # ensure they're all unique + d = {} + for v in value: + d[v] = 1 + self.assertEqual(len(d), 13) + def test_main(): run_unittest(CalendarTestCase) |