Skip to content

Conversation

@jyalim
Copy link

@jyalim jyalim commented Oct 27, 2025

Incrementally builds C99+ datetime support with addition of %F with single line of code. Also adds two tests: one for %F and another for previously supported %T.

Passed all tests (especially changes to new one).

Passed patchcheck.

@bedevere-app
Copy link

bedevere-app bot commented Oct 27, 2025

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 skip news label instead.

@python-cla-bot
Copy link

python-cla-bot bot commented Oct 27, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

import datetime
shorthand = datetime.datetime.strptime(test_time,formats["short"])
long_hand = datetime.datetime.strptime(test_time,formats["long"])
assert shorthand == long_hand
Copy link
Member

@StanFromIreland StanFromIreland Oct 27, 2025

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.

Copy link
Author

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 :)

@StanFromIreland StanFromIreland changed the title gh-140644: provide support for %F token in strptime; add test for it and %T gh-140715: provide support for %F token in strptime; add test for it and %T Oct 28, 2025
@StanFromIreland
Copy link
Member

I moved this under #140715, can you please update the blurb filename.

@jyalim
Copy link
Author

jyalim commented Oct 28, 2025

I moved this under #140715, can you please update the blurb filename.

I think this is done!

Comment on lines 660 to 663
import datetime
shorthand = datetime.datetime.strptime(test_date,formats["short"])
long_hand = datetime.datetime.strptime(test_date,formats["long"])
self.assertEqual(shorthand,long_hand)
Copy link
Member

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.

Copy link
Author

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

Comment on lines 672 to 676
# 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)
Copy link
Member

Choose a reason for hiding this comment

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

Ditto.

Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants