-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
RF: autoreplace assert_true(...==...) with plain assert #12547
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
Conversation
It is desired since assert_true (not even assert_equal) provides no information on actual value which fails the test === Do not change lines below === { "chain": [], "cmd": "git-sedi 'assert_true(\\( *.* == .*\\) *)$' 'assert \\1'", "exit": 0, "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^
invaid syntax ;) |
|
||
|
||
def check_cv_results_keys(cv_results, param_keys, score_keys, n_cand): | ||
# Test the search.cv_results_ contains all the required results | ||
assert_array_equal(sorted(cv_results.keys()), | ||
sorted(param_keys + score_keys + ('params',))) | ||
assert_true(all(cv_results[key].shape == (n_cand,) | ||
assert all(cv_results[key].shape == (n_cand, |
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.
invalid syntax here I think?
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.
also I see that the assert change from the original, is not?
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.
yeah -- the 'cons' of auto sed. will need to fix them up - didn't spot on a brief eye balling
=== Do not change lines below === { "chain": [], "cmd": "git-sedi 'assert_true( *\\(.*\\) *) *$' 'assert \\1'", "exit": 0, "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^
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.
We also need to remove relevant imports
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.
+1 for removing unused imports, we could also do the same thing for assert_equal
in a follow-up PR.
I would even suggest including this in 0.20.1 as it shouldn't affect users, but make understanding test failure logs easier.
There was an earlier discussion about the possibility of creating merge conflicts (can't find it anymore), but in this case, I think it's worth it.
Fine with 0.20.1, as long as we can finish it. @rth Maybe we don't need to do the same thing for assert_equal? We can still get things like |
I don't think there's a very strong incentive for assert_equal, so I wouldn't prioritize it? |
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.
would be nice to remove unused imports but that's manual work so I'd be fine with a separate PR.
checks like this not fixed. |
@stsouko Yes, this PR is not complete. One issue for some assert_true is how to handle the message. I think a PR to remove other assert_true is welcomed. |
What's hard about handling the message? The assert statement allows for a
message
|
You're right, apologies for the stupid comment. @stsouko Would you like to submit a PR? Otherwise I'll open an issue. |
At this moment I did a #12513. This assertion refers to the tests of voting classifier module. I fixed this test in PR. |
@stsouko please do it in a separate PR, thanks |
I can do full fix of voting tests. according to this conclusion. Is it OK? |
It's better to fix a single issue in each PR. |
done. |
…ybutton * upstream/master: FIX remove FutureWarning in _object_dtype_isnan and add test (scikit-learn#12567) DOC Add 's' to "correspond" in docs for Hamming Loss. (scikit-learn#12565) EXA Fix comment in plot-iris-logistic example (scikit-learn#12564) FIX stop words validation in text vectorizers with custom preprocessors / tokenizers (scikit-learn#12393) DOC Add skorch to related projects (scikit-learn#12561) MNT Don't change self.n_values in OneHotEncoder.fit (scikit-learn#12286) MNT Remove unused assert_true imports (scikit-learn#12560) TST autoreplace assert_true(...==...) with plain assert (scikit-learn#12547) DOC: add a testimonial from JP Morgan (scikit-learn#12555)
…ikit-learn into add_codeblock_copybutton * 'add_codeblock_copybutton' of https://github.com/thoo/scikit-learn: Move an extension under sphinx_copybutton/ Move css/js file under sphinxext/ Fix max_depth overshoot in BFS expansion of trees (scikit-learn#12344) TST don't test utils.fixes docstrings (scikit-learn#12576) DOC Fix typo (scikit-learn#12563) FIX Workaround limitation of cloudpickle under PyPy (scikit-learn#12566) MNT bare asserts (scikit-learn#12571) FIX incorrect error when OneHotEncoder.transform called prior to fit (scikit-learn#12443) Retrigger travis:max time limit error DOC: Clarify `cv` parameter description in `GridSearchCV` (scikit-learn#12495) FIX remove FutureWarning in _object_dtype_isnan and add test (scikit-learn#12567) DOC Add 's' to "correspond" in docs for Hamming Loss. (scikit-learn#12565) EXA Fix comment in plot-iris-logistic example (scikit-learn#12564) FIX stop words validation in text vectorizers with custom preprocessors / tokenizers (scikit-learn#12393) DOC Add skorch to related projects (scikit-learn#12561) MNT Don't change self.n_values in OneHotEncoder.fit (scikit-learn#12286) MNT Remove unused assert_true imports (scikit-learn#12560) TST autoreplace assert_true(...==...) with plain assert (scikit-learn#12547) DOC: add a testimonial from JP Morgan (scikit-learn#12555)
…it-learn#12547)" This reverts commit fb5d3a7.
…it-learn#12547)" This reverts commit fb5d3a7.
It is desired since
assert_true
(not even assert_equal) provides no information on actual value which fails the testNote: Command (
git-sedi
) recorded in the commit msg comes from my zshrc: