Skip to content

Commit 9383dee

Browse files
committed
iter
1 parent 32261cc commit 9383dee

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

imblearn/utils/tests/test_deprecation.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
# Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com>
44
# License: MIT
55

6+
import pytest
7+
68
from imblearn.utils.deprecation import deprecate_parameter
7-
from imblearn.utils.testing import warns
89

910

1011
class Sampler:
@@ -14,7 +15,7 @@ def __init__(self):
1415

1516

1617
def test_deprecate_parameter():
17-
with warns(DeprecationWarning, match="is deprecated from"):
18+
with pytest.warns(FutureWarning, match="is deprecated from"):
1819
deprecate_parameter(Sampler(), "0.2", "a")
19-
with warns(DeprecationWarning, match="Use 'b' instead."):
20+
with pytest.warns(FutureWarning, match="Use 'b' instead."):
2021
deprecate_parameter(Sampler(), "0.2", "a", "b")

imblearn/utils/tests/test_validation.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from imblearn.utils import check_neighbors_object
1717
from imblearn.utils import check_sampling_strategy
1818
from imblearn.utils import check_target_type
19-
from imblearn.utils.testing import warns, _CustomNearestNeighbors
19+
from imblearn.utils.testing import _CustomNearestNeighbors
2020
from imblearn.utils._validation import ArraysTransformer
2121
from imblearn.utils._validation import _deprecate_positional_args
2222

@@ -262,12 +262,8 @@ def test_check_sampling_strategy(
262262
def test_sampling_strategy_dict_over_sampling():
263263
y = np.array([1] * 50 + [2] * 100 + [3] * 25)
264264
sampling_strategy = {1: 70, 2: 140, 3: 70}
265-
expected_msg = (
266-
r"After over-sampling, the number of samples \(140\) in"
267-
r" class 2 will be larger than the number of samples in"
268-
r" the majority class \(class #2 -> 100\)"
269-
)
270-
with warns(UserWarning, expected_msg):
265+
expected_msg = "After over-sampling, the number of samples "
266+
with pytest.warns(UserWarning, match=expected_msg):
271267
check_sampling_strategy(sampling_strategy, y, "over-sampling")
272268

273269

0 commit comments

Comments
 (0)