-
-
Couldn't load subscription status.
- Fork 33.2k
gh-140715: provide support for %F token in strptime; add test for it and %T #140647
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
base: main
Are you sure you want to change the base?
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Misc/NEWS.d/next/Library/2025-10-27-00-13-04.gh-issue-140644.WkozE0.rst
Outdated
Show resolved
Hide resolved
Lib/test/test_strptime.py
Outdated
| import datetime | ||
| shorthand = datetime.datetime.strptime(test_time,formats["short"]) | ||
| long_hand = datetime.datetime.strptime(test_time,formats["long"]) | ||
| assert shorthand == long_hand |
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.
Use unittest methods, but these should be in the datetime tests anyway.
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.
I've resolved the first part of your comment, I think :)
|
I moved this under #140715, can you please update the blurb filename. |
Co-authored-by: Stan Ulbrych <[email protected]>
…kozE0.rst Co-authored-by: Stan Ulbrych <[email protected]>
I think this is done! |
Lib/test/test_strptime.py
Outdated
| import datetime | ||
| shorthand = datetime.datetime.strptime(test_date,formats["short"]) | ||
| long_hand = datetime.datetime.strptime(test_date,formats["long"]) | ||
| self.assertEqual(shorthand,long_hand) |
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.
These should be in datetimetester.py.
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.
Thanks! Okay these lines were removed from test_strptime.py and a (passed) test was added to datetimetester.py
Lib/test/test_strptime.py
Outdated
| # ensure datetime functionality | ||
| import datetime | ||
| shorthand = datetime.datetime.strptime(test_time,formats["short"]) | ||
| long_hand = datetime.datetime.strptime(test_time,formats["long"]) | ||
| self.assertEqual(shorthand,long_hand) |
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.
Ditto.
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.
Thanks again! These lines were also removed from test_strptime.py and a (passed) test was added to datetimetester.py
Misc/NEWS.d/next/Library/2025-10-27-00-13-04.gh-issue-140715.WkozE0.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Stan Ulbrych <[email protected]>
Incrementally builds C99+ datetime support with addition of
%Fwith single line of code. Also adds two tests: one for%Fand another for previously supported%T.Passed all tests (especially changes to new one).
Passed patchcheck.
strptimetoken support and documentation modernization #140644str*timeto C11 format codes #140715