Skip to content

TST Change assert from sklearn to pytest style in tests/test_multioutput.py #19663

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

Closed
wants to merge 3 commits into from

Conversation

azihna
Copy link
Contributor

@azihna azihna commented Mar 11, 2021

Reference Issues/PRs
References #14216

What does this implement/fix? Explain your changes.
Changed the assert_raises, assert_message, assert_warns in tests/test_multioutput.py to pytest.raises().

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a quick suggestion for further improvement:

# ValueError when number of outputs is different
# for fit and score
y_new = np.column_stack((y1, y2))
moc.fit(X, y)
assert_raises(ValueError, moc.score, X, y_new)
with pytest.raises(ValueError):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a check on the message itself for this one. Then you can probably remove the inline comment above because it's going to be redundant with the check itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed new changes to amend this. Thanks @ogrisel.

@jeremiedbb
Copy link
Member

@azihna looks good but you have merge conflicts :)

@azihna
Copy link
Contributor Author

azihna commented Mar 12, 2021

@jeremiedbb The conflicts seem to be because of some deleted comments. I'd like to resolve them but I can't :)

@jeremiedbb
Copy link
Member

Well I just realized that you already submitted the exact same PR (#19618) and it was merged. We can close this PR. Thanks for your contribution

@jeremiedbb jeremiedbb closed this Mar 12, 2021
@azihna azihna deleted the fix_multioutput_asserts branch March 12, 2021 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants