Issue36782
Created on 2019-05-03 13:46 by p-ganssle, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 13088 | merged | python-dev, 2019-05-04 21:22 | |
| Messages (9) | |||
|---|---|---|---|
| msg341336 - (view) | Author: Paul Ganssle (p-ganssle) * ![]() |
Date: 2019-05-03 13:46 | |
A decent fraction of the datetime C API has no tests. If we had tests, we could have prevented 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: https://github.com/python/cpython/pull/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: - PyDate_FromDate / PyDateTimeAPI->Date_FromDate - PyDateTime_FromDateAndTime / PyDateTimeAPI->DateTime_FromDateAndTime - PyDateTime_FromDateAndTimeAndFold / PyDateTimeAPI->DateTime_FromDateAndTimeAndFold - PyTime_FromTime -> PyDateTimeAPI->Time_FromTime - PyTime_FromTimeAndFold -> PyDateTime->Time_FromTimeAndFold - PyDelta_FromDSU / PyDateTime->Delta_FromDelta Untested macros with no corresponding API module: - PyDateTime_DATE_GET_YEAR - PyDateTime_DATE_GET_MONTH - PyDateTime_DATE_GET_DAY - PyDateTime_DATE_GET_HOUR - PyDateTime_DATE_GET_MINUTE - PyDateTime_DATE_GET_SECOND - PyDateTime_DATE_GET_MICROSECOND - PyDateTime_DELTA_GET_DAYS - PyDateTime_DELTA_GET_SECONDS - PyDateTime_DELTA_GET_MICROSECONDS I can spawn smaller issues for this if that's preferred, but I figured we'd start with this big meta-issue. |
|||
| msg341346 - (view) | Author: Paul Ganssle (p-ganssle) * ![]() |
Date: 2019-05-03 16:04 | |
This ticket should be reserved for the mentored sprint. |
|||
| msg341400 - (view) | Author: anthony shaw (anthony shaw) | Date: 2019-05-04 19:50 | |
Reserving this issue (in mentored sprint) |
|||
| msg341408 - (view) | Author: Edison Abahurire (edison.abahurire) * | Date: 2019-05-04 21:26 | |
I have done PyDate_FromDate in GH-13088 |
|||
| msg341497 - (view) | Author: Edison Abahurire (edison.abahurire) * | Date: 2019-05-06 13:43 | |
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. |
|||
| msg341673 - (view) | Author: Edison Abahurire (edison.abahurire) * | Date: 2019-05-07 03:12 | |
I have submitted PR (under review) for these tests: - PyDate_FromDate / PyDateTimeAPI->Date_FromDate - PyDateTime_FromDateAndTime / PyDateTimeAPI->DateTime_FromDateAndTime - PyDateTime_FromDateAndTimeAndFold / PyDateTimeAPI->DateTime_FromDateAndTimeAndFold - PyTime_FromTime -> PyDateTimeAPI->Time_FromTime - PyTime_FromTimeAndFold -> PyDateTime->Time_FromTimeAndFold - PyDelta_FromDSU / PyDateTime->Delta_FromDelta |
|||
| msg341674 - (view) | Author: Edison Abahurire (edison.abahurire) * | Date: 2019-05-07 03:14 | |
@p-ganssle Please open a new bpo for the Untested macros. I will be happy to work on that in the sprints tomorrow. |
|||
| msg342761 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2019-05-17 20:28 | |
New changeset 98ff4d5fb6a9d01b0176b7786db61346952e5295 by Victor Stinner (Edison A) in branch 'master': bpo-36782: Created C API wrappers and added missing tests for functions in the PyDateTimeAPI. (#13088) https://github.com/python/cpython/commit/98ff4d5fb6a9d01b0176b7786db61346952e5295 |
|||
| msg343705 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2019-05-27 23:36 | |
Paul Ganssle is in favor of backporting new tests to Python 3.7: https://github.com/python/cpython/pull/13088#issuecomment-493591633 But automated backports failed with a conflict. If someone wants to backport it manually, please go ahead! In the meanwhile, I close the issue. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:14 | admin | set | github: 80963 |
| 2019-05-27 23:36:05 | vstinner | set | status: open -> closed versions: - Python 3.9 messages: + msg343705 resolution: fixed |
| 2019-05-17 20:28:48 | vstinner | set | nosy:
+ vstinner messages: + msg342761 |
| 2019-05-07 03:14:33 | edison.abahurire | set | messages: + msg341674 |
| 2019-05-07 03:12:50 | edison.abahurire | set | messages: + msg341673 |
| 2019-05-06 13:43:04 | edison.abahurire | set | messages: + msg341497 |
| 2019-05-04 21:26:42 | edison.abahurire | set | messages: + msg341408 |
| 2019-05-04 21:22:18 | python-dev | set | keywords:
+ patch stage: patch review pull_requests: + pull_request13002 |
| 2019-05-04 19:53:29 | anthony shaw | set | nosy:
+ edison.abahurire |
| 2019-05-04 19:50:07 | anthony shaw | set | nosy:
+ anthony shaw messages: + msg341400 |
| 2019-05-03 16:04:07 | p-ganssle | set | assignee: Mariatta |
| 2019-05-03 13:48:26 | ericvw | set | nosy:
+ ericvw |
| 2019-05-03 13:46:57 | p-ganssle | create | |
