8000 add changelog and fixed errors in test_Stratified_mandatory_y_argument · scikit-learn/scikit-learn@f24c4c9 · GitHub
[go: up one dir, main page]

Skip to content

Commit f24c4c9

Browse files
committed
add changelog and fixed errors in test_Stratified_mandatory_y_argument
1 parent 3cbd18f commit f24c4c9

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

doc/whats_new/v1.6.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ Changelog
182182
estimator without re-fitting it.
183183
:pr:`29067` by :user:`Guillaume Lemaitre <glemaitre>`.
184184

185+
- |Fix| :class:`model_selection.RepeatedStratifiedKFold` has the function split,
186+
where 'y' parameter is made as mandatory input field.
187+
:pr:`29402` by :user:`Anurag Varma <Anurag-Varma>`.
188+
185189
:mod:`sklearn.neighbors`
186190
........................
187191

sklearn/model_selection/tests/test_split.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,18 +2061,12 @@ def test_Stratified_mandatory_y_argument():
20612061
# y = [0] * 90 + [1] * 10
20622062
# Variable 'y' is required for Stratified classes split function.
20632063
# Testing the split without 'y', shoudl raise TypeError.
2064+
msg = r"split\(\) missing 1 required positional argument: 'y'"
20642065

20652066
cv = StratifiedKFold(n_splits=2)
2066-
msg = r".*StratifiedKFold\.split\(\) missing 1 required positional argument: 'y'.*"
20672067
with pytest.raises(TypeError, match=msg):
2068-
for _i, (_train, _test) in enumerate(cv.split(x)):
2069-
pass
2068+
cv.split(x)
20702069

20712070
cv = RepeatedStratifiedKFold(n_splits=2, n_repeats=3)
2072-
msg = (
2073-
r".*RepeatedStratifiedKFold\.split\(\) "
2074-
r"missing 1 required positional argument: 'y'.*"
2075-
)
20762071
with pytest.raises(TypeError, match=msg):
2077-
for _i, (_train, _test) in enumerate(cv.split(x)):
2078-
pass
2072+
cv.split(x)

0 commit comments

Comments
 (0)
0