-
-
Notifications
You must be signed in to change notification settings - Fork 26k
MAINT Adjust tests for numpydoc 1.2 #22287
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
MAINT Adjust tests for numpydoc 1.2 #22287
Conversation
I need a tinker with this PR a little more before it is ready for review. |
@@ -546,8 +536,6 @@ def test_check_docstring_parameters(mock_meta): | |||
"was no space between the param name and colon ('a: int')", | |||
"sklearn.utils.tests.test_testing.f_check_param_definition There " | |||
"was no space between the param name and colon ('b:')", | |||
"sklearn.utils.tests.test_testing.f_check_param_definition " | |||
"Parameter 'c :' has an empty type spec. Remove the colon", |
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.
In numpydoc 1.2, the c :
is now parsed into c
+ empty type spec.
sklearn/utils/tests/test_testing.py
Outdated
"potentially wrong underline length... ", | ||
"Parameters ", | ||
"--------- in ", | ||
"This is available only if delegate has predict_proba.", |
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.
This it the new error message, when the Parameters
header does not have the correct underline length.
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 for the PR.
I need a ticker with this PR a little more before it is ready for review.
I read that too late. Here is some feedback.
I did not review but we were discussing yesterday with @ogrisel to maybe make the tests more general to not be caught in the same string matching later on. |
The test is checking the strings we are creating: scikit-learn/sklearn/utils/_testing.py Lines 701 to 708 in cd10651
The reason our tests started to fail is that PR is ready for review. |
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.
LGTM.
Co-authored-by: Julien Jerphanion <[email protected]>
sklearn/utils/tests/test_testing.py
Outdated
@@ -495,7 +495,7 @@ def score(self, X): | |||
"""This is available only if delegate has score. | |||
|
|||
Parameters | |||
--------- | |||
---------- | |||
y : ndarray | |||
Parameter y | |||
""" |
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 think we need a new test method with a bad underline formatting to cover the new warning/exception handling logic (while still covering the originally intended test cases).
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.
codecov agrees with me :)
https://app.codecov.io/gh/scikit-learn/scikit-learn/compare/22287/changes#D1L672
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 reverted this change and updating the assert with the new error message
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.
LGTM assuming CI passes after the latest changes.
Thanks @thomasjpfan |
Co-authored-by: Julien Jerphanion <[email protected]> Co-authored-by: Olivier Grisel <[email protected]>
Reference Issues/PRs
Follow up to #22286
What does this implement/fix? Explain your changes.
The big change is how
numpydoc
will not parse sections if the number of characters underlining the subsection is incorrect.Any other comments?
CC @ogrisel