summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2004-07-08 17:14:17 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2004-07-08 17:14:17 (GMT)
commit302fa6dc0d90f3e5aac66347458c69713ae7581d (patch)
treea1dd1af4f57d2a2063509ff54e56221fbb9f84fb /Lib
parent238499060351da61665c1e623c5f59c6d0ef3354 (diff)
downloadcpython-302fa6dc0d90f3e5aac66347458c69713ae7581d.zip
cpython-302fa6dc0d90f3e5aac66347458c69713ae7581d.tar.gz
cpython-302fa6dc0d90f3e5aac66347458c69713ae7581d.tar.bz2
Add another bunch of test cases for calendars with Sunday as the
first day of the week.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_calendar.py61
1 files changed, 60 insertions, 1 deletions
diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py
index 58f27f1..2dc486f 100644
--- a/Lib/test/test_calendar.py
+++ b/Lib/test/test_calendar.py
@@ -128,10 +128,69 @@ class MondayTestCase(MonthCalendarTestCase):
self.check_weeks(2068, 12, (2, 7, 7, 7, 7, 1))
+class SundayTestCase(MonthCalendarTestCase):
+ firstweekday = calendar.SUNDAY
+
+ def test_february(self):
+ # A 28-day february starting of sunday (7+7+7+7 days)
+ self.check_weeks(2009, 2, (7, 7, 7, 7))
+
+ # A 28-day february starting of monday (6+7+7+7+1 days)
+ self.check_weeks(1999, 2, (6, 7, 7, 7, 1))
+
+ # A 28-day february starting of saturday (1+7+7+7+6 days)
+ self.check_weeks(1997, 2, (1, 7, 7, 7, 6))
+
+ # A 29-day february starting of sunday (7+7+7+7+1 days)
+ self.check_weeks(2004, 2, (7, 7, 7, 7, 1))
+
+ # A 29-day february starting of monday (6+7+7+7+2 days)
+ self.check_weeks(1960, 2, (6, 7, 7, 7, 2))
+
+ # A 29-day february starting of saturday (1+7+7+7+7 days)
+ self.check_weeks(1964, 2, (1, 7, 7, 7, 7))
+
+ def test_april(self):
+ # A 30-day april starting of sunday (7+7+7+7+2 days)
+ self.check_weeks(1923, 4, (7, 7, 7, 7, 2))
+
+ # A 30-day april starting of monday (6+7+7+7+3 days)
+ self.check_weeks(1918, 4, (6, 7, 7, 7, 3))
+
+ # A 30-day april starting of saturday (1+7+7+7+7+1 days)
+ self.check_weeks(1950, 4, (1, 7, 7, 7, 7, 1))
+
+ # A 30-day april starting of friday (2+7+7+7+7 days)
+ self.check_weeks(1960, 4, (2, 7, 7, 7, 7))
+
+ # A 30-day april starting of thursday (3+7+7+7+6 days)
+ self.check_weeks(1909, 4, (3, 7, 7, 7, 6))
+
+ def test_december(self):
+ # A 31-day december starting of sunday (7+7+7+7+3 days)
+ self.check_weeks(2080, 12, (7, 7, 7, 7, 3))
+
+ # A 31-day december starting of monday (6+7+7+7+4 days)
+ self.check_weeks(1941, 12, (6, 7, 7, 7, 4))
+
+ # A 31-day december starting of saturday (1+7+7+7+7+2 days)
+ self.check_weeks(1923, 12, (1, 7, 7, 7, 7, 2))
+
+ # A 31-day december starting of wednesday (4+7+7+7+6 days)
+ self.check_weeks(1948, 12, (4, 7, 7, 7, 6))
+
+ # A 31-day december starting of thursday (3+7+7+7+7 days)
+ self.check_weeks(1927, 12, (3, 7, 7, 7, 7))
+
+ # A 31-day december starting of friday (2+7+7+7+7+1 days)
+ self.check_weeks(1995, 12, (2, 7, 7, 7, 7, 1))
+
+
def test_main():
test_support.run_unittest(
CalendarTestCase,
- MondayTestCase
+ MondayTestCase,
+ SundayTestCase
)