Skip to content

Commit deec149

Browse files
author
Joan Massich
committed
Migrate assert_raises_regex to pytest.raises
1 parent 8cbcc77 commit deec149

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

imblearn/over_sampling/tests/test_adasyn.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77

88
import numpy as np
99
from sklearn.utils.testing import assert_allclose, assert_array_equal
10-
from sklearn.utils.testing import assert_raises_regex
1110
from sklearn.neighbors import NearestNeighbors
1211

1312
from imblearn.over_sampling import ADASYN
1413

14+
from pytest import raises
15+
1516
RND_SEED = 0
1617
X = np.array([[0.11622591, -0.0317206], [0.77481731, 0.60935141],
1718
[1.25192108, -0.22367336], [0.53366841, -0.30312976],
@@ -141,5 +142,5 @@ def test_ada_fit_sample_nn_obj():
141142
def test_ada_wrong_nn_obj():
142143
nn = 'rnd'
143144
ada = ADASYN(random_state=RND_SEED, n_neighbors=nn)
144-
assert_raises_regex(ValueError, "has to be one of",
145-
ada.fit_sample, X, Y)
145+
with raises(ValueError, match="has to be one of"):
146+
ada.fit_sample(X, Y)

0 commit comments

Comments
 (0)