-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-46484:Add test for Calendar.iterweekdays #30825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Misc/NEWS.d/next/Tests/2022-01-23-18-21-30.bpo-46484.5BSQvY.rst
Outdated
Show resolved
Hide resolved
Lib/test/test_calendar.py
Outdated
for firstweekday in range(7): | ||
cal = calendar.Calendar(firstweekday) | ||
week = list(cal.iterweekdays()) | ||
self.assertEqual(week[0], firstweekday) | ||
self.assertEqual(week[-1], (firstweekday - 1) % 7) | ||
self.assertEqual(week, result[firstweekday]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could write this test like this:
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)
Thanks @180909 for the PR, and @iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10. |
GH-32307 is a backport of this pull request to the 3.10 branch. |
GH-32308 is a backport of this pull request to the 3.9 branch. |
(cherry picked from commit 48269ea) Co-authored-by: 180909 <[email protected]>
(cherry picked from commit 48269ea) Co-authored-by: 180909 <[email protected]>
(cherry picked from commit 48269ea) Co-authored-by: 180909 <[email protected]>
(cherry picked from commit 48269ea) Co-authored-by: 180909 <[email protected]>
https://bugs.python.org/issue46484
https://bugs.python.org/issue46484