Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-133940: test_strftime incorrectly calculates expected week#134281

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gpshead merged 1 commit intopython:mainfromGGyll:main
May 20, 2025
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletionLib/test/test_strftime.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,7 +39,21 @@ def _update_variables(self, now):
ifnow[3]<12:self.ampm='(AM|am)'
else:self.ampm='(PM|pm)'

self.jan1=time.localtime(time.mktime((now[0],1,1,0,0,0,0,1,0)))
jan1=time.struct_time(
(
now.tm_year,# Year
1,# Month (January)
1,# Day (1st)
0,# Hour (0)
0,# Minute (0)
0,# Second (0)
-1,# tm_wday (will be determined)
1,# tm_yday (day 1 of the year)
-1,# tm_isdst (let the system determine)
)
)
# use mktime to get the correct tm_wday and tm_isdst values
self.jan1=time.localtime(time.mktime(jan1))
Comment on lines +42 to +56
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
jan1=time.struct_time(
(
now.tm_year,# Year
1,# Month (January)
1,# Day (1st)
0,# Hour (0)
0,# Minute (0)
0,# Second (0)
-1,# tm_wday (will be determined)
1,# tm_yday (day 1 of the year)
-1,# tm_isdst (let the system determine)
)
)
# use mktime to get the correct tm_wday and tm_isdst values
self.jan1=time.localtime(time.mktime(jan1))
self.jan1=time.localtime(time.mktime((now[0],1,1,0,0,0,-1,1,-1)))

Why not just all on one line like before, it seems clear to me, and this is a test after all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

FWIW I like the long version myself.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

IMO it is overkill and distracting, if you are looking at these tests you are probably familiar withstruct_time anyway.


try:
ifnow[8]:self.tz=time.tzname[1]
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp