Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0df7abf

Browse filesBrowse files
TST replace asert_warns by pytest.warns in compose/tests (#19492)
Co-authored-by: Olivier Grisel <olivier.grisel@gmail.com> Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
1 parent f0a6f05 commit 0df7abf
Copy full SHA for 0df7abf

File tree

2 files changed

+3
-5
lines changed
Filter options

2 files changed

+3
-5
lines changed

‎sklearn/compose/tests/test_target.py

Copy file name to clipboardExpand all lines: sklearn/compose/tests/test_target.py
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from sklearn.dummy import DummyRegressor
99

1010
from sklearn.utils._testing import assert_allclose
11-
from sklearn.utils._testing import assert_warns_message
1211
from sklearn.utils._testing import assert_no_warnings
1312

1413
from sklearn.preprocessing import FunctionTransformer
@@ -54,9 +53,9 @@ def test_transform_target_regressor_invertible():
5453
regr = TransformedTargetRegressor(regressor=LinearRegression(),
5554
func=np.sqrt, inverse_func=np.log,
5655
check_inverse=True)
57-
assert_warns_message(UserWarning, "The provided functions or transformer"
58-
" are not strictly inverse of each other.",
59-
regr.fit, X, y)
56+
with pytest.warns(UserWarning, match="The provided functions or"
57+
" transformer are not strictly inverse of each other."):
58+
regr.fit(X, y)
6059
regr = TransformedTargetRegressor(regressor=LinearRegression(),
6160
func=np.sqrt, inverse_func=np.log)
6261
regr.set_params(check_inverse=False)

‎sklearn/neighbors/tests/test_nearest_centroid.py

Copy file name to clipboardExpand all lines: sklearn/neighbors/tests/test_nearest_centroid.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""
22
Testing for the nearest centroid module.
33
"""
4-
54
import numpy as np
65
import pytest
76
from scipy import sparse as sp

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.