10000 TST Replace pytest.warns(None) in test_feature_select (#23041) · scikit-learn/scikit-learn@087c7e2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 087c7e2

Browse files
authored
TST Replace pytest.warns(None) in test_feature_select (#23041)
1 parent 408afcc commit 087c7e2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sklearn/feature_selection/tests/test_feature_select.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ def test_r_regression_force_finite(X, y, expected_corr_coef, force_finite):
208208
Non-regression test for:
209209
https://github.com/scikit-learn/scikit-learn/issues/15672
210210
"""
211-
with pytest.warns(None) as records:
211+
with warnings.catch_warnings():
212+
warnings.simplefilter("error", RuntimeWarning)
212213
corr_coef = r_regression(X, y, force_finite=force_finite)
213-
assert not [w.message for w in records]
214214
np.testing.assert_array_almost_equal(corr_coef, expected_corr_coef)
215215

216216

@@ -291,9 +291,9 @@ def test_f_regression_corner_case(
291291
Non-regression test for:
292292
https://github.com/scikit-learn/scikit-learn/issues/15672
293293
"""
294-
with pytest.warns(None) as records:
294+
with warnings.catch_warnings():
295+
warnings.simplefilter("error", RuntimeWarning)
295296
f_statistic, p_values = f_regression(X, y, force_finite=force_finite)
296-
assert not [w.message for w in records]
297297
np.testing.assert_array_almost_equal(f_statistic, expected_f_statistic)
298298
np.testing.assert_array_almost_equal(p_values, expected_p_values)
299299

0 commit comments

Comments
 (0)
0