-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Add tests for the datetime C API #80963
Comments
A decent fraction of the datetime C API has no tests. If we had tests, we could have prevented bpo bpo-36025, which was a regression in the FromTimestamp method. I would like to open this issue to suggest the addition of tests for the full interface, to prevent further regressions here. To write a test, first add a wrapper function in the _testcapimodule module: https://github.com/python/cpython/blob/master/Modules/_testcapimodule.c#L2218 Then test that function here: https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py#L5821 See an example at GH PR 11922: #11922 I recommend testing *both* the version of the function accessed by the Macro (e.g. PyDate_FromTimestamp) and from the C API capsule (e.g. PyDateTimeApi->FromTimestamp), since projects access these functions in both ways. C API Documentation is here: https://docs.python.org/3/c-api/datetime.html Currently untested:
Untested macros with no corresponding API module:
I can spawn smaller issues for this if that's preferred, but I figured we'd start with this big meta-issue. |
This ticket should be reserved for the mentored sprint. |
Reserving this issue (in mentored sprint) |
I have done PyDate_FromDate in #57297 |
I have done PyDateTime_FromDateAndTime. I'm moving on to add PyDateTime_FromDateAndTimeAndFold (plus documentation for fold as requested in https://bugs.python.org/issue36783) before making a PR. |
I have submitted PR (under review) for these tests:
|
@p-ganssle |
Paul Ganssle is in favor of backporting new tests to Python 3.7: But automated backports failed with a conflict. If someone wants to backport it manually, please go ahead! In the meanwhile, I close the issue. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: