SF bug 533234: tm_isdst > 1 Passed to strftime.
One more time on this turkey, but duller instead of cleverer.
Curious: The docs say __getslice__ has been deprecated since 2.0, but
list.__getitem__ still doesn't work if you pass it a slice. This makes
it a lot clearer to emulate a list by *being* a list <wink>.
Bugfix candidate. Michael, just pile this patch on top of the others
that went by -- no need to try to pick these apart.
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 @@
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)