summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_calendar.py
diff options
context:
space:
mode:
author180909 <734461790@qq.com>2022-04-04 17:16:56 (GMT)
committerGitHub <noreply@github.com>2022-04-04 17:16:56 (GMT)
commit48269ea9fdbc5804f80962364f95e69097c417ba (patch)
tree198693ff5dd2b3aa9529793e8b6750296d760527 /Lib/test/test_calendar.py
parentd1b1c885d8f276a0b1ff2e327270916396a8b842 (diff)
downloadcpython-48269ea9fdbc5804f80962364f95e69097c417ba.zip
cpython-48269ea9fdbc5804f80962364f95e69097c417ba.tar.gz
cpython-48269ea9fdbc5804f80962364f95e69097c417ba.tar.bz2
bpo-46484:Add test for Calendar.iterweekdays (GH-30825)
Diffstat (limited to 'Lib/test/test_calendar.py')
-rw-r--r--Lib/test/test_calendar.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py
index e6bd4d0..f76cbc9 100644
--- a/Lib/test/test_calendar.py
+++ b/Lib/test/test_calendar.py
@@ -619,6 +619,14 @@ class CalendarTestCase(unittest.TestCase):
self.assertEqual(days[0][1], firstweekday)
self.assertEqual(days[-1][1], (firstweekday - 1) % 7)
+ def test_iterweekdays(self):
+ week0 = list(range(7))
+ for firstweekday in range(7):
+ cal = calendar.Calendar(firstweekday)
+ week = list(cal.iterweekdays())
+ expected = week0[firstweekday:] + week0[:firstweekday]
+ self.assertEqual(week, expected)
+
class MonthCalendarTestCase(unittest.TestCase):
def setUp(self):