bpo-36782: Created C API wrappers and added missing tests for functions in the PyDateTimeAPI.#13088
bpo-36782: Created C API wrappers and added missing tests for functions in the PyDateTimeAPI.#13088vstinner merged 47 commits intopython:masterfrom
Conversation
pganssle
left a comment
There was a problem hiding this comment.
Thank you for this contribution! I'm very excited to have these added to the datetime test suite!
The Python portion of the code looks good to me, but I have some formatting notes on the C functions.
Modules/_testcapimodule.c
Outdated
| {"test_incref_doesnt_leak", test_incref_doesnt_leak, METH_NOARGS}, | ||
| {"test_xdecref_doesnt_leak",test_xdecref_doesnt_leak, METH_NOARGS}, | ||
| {"test_decref_doesnt_leak", test_decref_doesnt_leak, METH_NOARGS}, | ||
| {"raise_exception", raise_exception, METH_VARARGS}, |
There was a problem hiding this comment.
Are these formatting changes deliberate? I know some editors will be somewhat aggressive with making formatting changes.
I think it would be best to leave the original formatting intact, if only to make the diff easier to review.
Misc/NEWS.d/next/Tests/2019-05-04-21-25-19.bpo-36782.h3oPIb.rst
Outdated
Show resolved
Hide resolved
|
I have made the changes that you requested. @pganssle Please review. |
Lib/test/datetimetester.py
Outdated
| with self.subTest(macro=macro): | ||
| d = _testcapi.get_date_fromdate(year, month, day, macro) | ||
|
|
||
| self.assertEqual(d, date(1993, 8, 26)) |
There was a problem hiding this comment.
and because I don't like the duplicated code, you could use that.
self.assertEqual(d, date(year, month, day))I think you could also compute one time the expected date. and because I like to be explicit...
def test_date_from_date(self):
expected_date = date(1993, 8, 26)
for macro in (0, 1):
with self.subTest(macro=macro):
new_date = _testcapi.get_date_fromdate(expected_date.year, expected_date.month, expected_date.day, macro)
self.assertEqual(new_date, expected_date)|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
I have made the requested changes; please review again |
|
Thanks for making the requested changes! @matrixise: please review the changes made to this pull request. |
| @@ -0,0 +1,2 @@ | |||
| Created a test C API wrapper for PyDate_FromDate and added a test for PyDate_FromDate. | |||
There was a problem hiding this comment.
Talked to Edison in the room, he will have an updated blurb that I have looked at. The current one is grammatically fine but could be tightened up and could use RST directives.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
pganssle
left a comment
There was a problem hiding this comment.
New changes look good to me.
pganssle
left a comment
There was a problem hiding this comment.
I've suggested changing all the int macro = 0 to int macro; now that macro is required, but otherwise this PR looks good and we can merge it.
change all the int macro = 0 to int macro; now that macro is required Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com>
change all the `int macro = 0` to `int macro`; now that macro is required Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com>
change all the `int macro = 0` to `int macro`; now that macro is required Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com>
change all the `int macro = 0` to `int macro`; now that macro is required Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com>
change all the `int macro = 0` to `int macro`; now that macro is required Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com>
change all the `int macro = 0` to `int macro`; now that macro is required Co-Authored-By: Paul Ganssle <pganssle@users.noreply.github.com>
matrixise
left a comment
There was a problem hiding this comment.
Thank you for your contribution. 🎉
|
Well done @SimiCode, modifying C code and tests is not trivial! |
|
@vstinner: Please replace |
|
Crap. I modified the commit message, but the merge failed. I click on Retry, and then it lost all my changes on the commit message :-( |
|
@pganssle: Do we need to backport the change to 3.7? |
|
@vstinner It only adds tests, so while I don't think it would hurt to backport the change to 3.7, it's not really necessary. |
|
Sorry, @SimiCode and @vstinner, I could not cleanly backport this to |
https://bugs.python.org/issue36782