-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
test_strftime
incorrectly calculates expected week
#133940
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
Comments
As per the docs for time:
So you can say the week number is 0-indexed since the first week of the year is 0. Although I think the wording makes it confusing, especially since datetime.datetime.now().isocalendar() returns 21 Regarding the test failing on IST, I was not able to reproduce this issue, I tried mocking IST time and got 20 both as expected value and the output (as per today May 19th, 2025). Perhaps this could be an issue regarding ISO 8601 Standard calculating week number by Thursdays, and the US system calculating by number of Sundays? |
Just to check, you used On my machine:
|
I tried with Indian, now with Irish and it fails.. looking into this now |
…ythonGH-134281) Let the system determine the correct tm_wday and tm_isdst. (cherry picked from commit e3dda8f) Co-authored-by: Gustaf <79180496+GGyll@users.noreply.github.com>
…ythonGH-134281) Let the system determine the correct tm_wday and tm_isdst. (cherry picked from commit e3dda8f) Co-authored-by: Gustaf <79180496+GGyll@users.noreply.github.com>
Thanks for the contribution! |
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
This is not a duplicate of other IST related issues,
this is just a bug in the test itself from a quick look.After further investigation it appears this is indeed just a IST bug but the test also calculates it wrong.From buildbot run (on IST):
It seems both the expected and returned are wrong, according to this website it should be week 20. Week 0 is days before the first week, so it would exist in our case, if it is counted, then the returned value is correct, but the test is wrong. Test passes in UTC however.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: