-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
TST Change assert from sklearn to pytest style in tests/test_discriminant.py #19558
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
Note: I edited the title to make it more explicit about which module is impacted when scanning though the discussion history of #14216. |
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, it's better. I think we could make the test even clearer by checking the messages:
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.
Ok I investigated #19558 (review) and found that the runtime warning (divide by zero) was always raised at predict time only (for the unregularized case) while the fit method only raises the UserWarning
.
I reorganized the checks accordingly.
I think this highlights suboptimal warning behavior of this class. I will open a dedicated issue. Fixing this can be done in a subsequent PR to keep the scope of this PR focused on the original problem.
Thanks @ogrisel |
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.
Reference Issues/PRs
Reference #14216
What does this implement/fix? Explain your changes.
Changed the assert_raises, assert_message, assert_warns in tests/test_discriminant.py to pytest.raises() and pytest.warns.
Changed ignore_warnings to @pytest.mark.filterwarnings() because each assert in the test was encapsulated in ignore_warnings context.