[MRG] CLN Remove the use of assert_raises in utils/#16337
[MRG] CLN Remove the use of assert_raises in utils/#16337agramfort merged 11 commits intoscikit-learn:masterfrom
Conversation
+1
These are helpers, only used in the tests |
| assert_raises(TypeError, incr_mean_variance_axis, X_lil, axis, | ||
| last_mean, last_var, last_n) | ||
|
|
||
| with pytest.raises(TypeError): |
There was a problem hiding this comment.
So we ran this test twice on master ;)
There was a problem hiding this comment.
Indeed, it could have been on purpose if the function was mutating an argument but that is not the case here :)
|
Please note that there still are some references to assert_raises and assert_raises_message in test_testing.py. They should be kept as long as these functions are used elsewhere |
|
Although unfortunately we will have to revert changes in |
|
thx @Batalex |
* CLN use pytest raises ctxt manager for class weights & estimators [skip ci] * CLN use pytest raises ctxt manager for multiclass test * CLN use pytest warns in estimator checks test * CLN use pytest raises ctxt manager for random test * CLN use pytest raises ctxt manager for sparsefuncs test * CLN use pytest raises ctxt manager for testing utils tests * CLN use pytest raises ctxt manager for utils tests * CLN use pytest raises ctxt manager for validation tests * revert test_estimator_check.py to upstream master
* CLN use pytest raises ctxt manager for class weights & estimators [skip ci] * CLN use pytest raises ctxt manager for multiclass test * CLN use pytest warns in estimator checks test * CLN use pytest raises ctxt manager for random test * CLN use pytest raises ctxt manager for sparsefuncs test * CLN use pytest raises ctxt manager for testing utils tests * CLN use pytest raises ctxt manager for utils tests * CLN use pytest raises ctxt manager for validation tests * revert test_estimator_check.py to upstream master
Reference Issues/PRs
Related to #14216
What does this implement/fix? Explain your changes.
Replace occurences of
assert_raises&assert_raises_regexin the following files:sklearn/utils/tests/test_estimator_checks.pyAny other comments?
assert_warnswithpytest.warnscontext manager?assert_raisesis also used outside test files (namely,sklearn/utils/_testing.pyandsklearn/utils/estimator_checks.pyfor simple checks. Is that normal? Does it not risk to produce errors with the python-Oflag?Edit: test_estimator_checks.py has been reverted to its prior state because it should run even without pytest.