Skip to content

Commit 439bf1a

Browse files
FarahSaeedjnothman
authored andcommitted
TEST caught deprecation warning for min_impurity_split (scikit-learn#10202)
1 parent 2c7473f commit 439bf1a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

sklearn/tree/tests/test_tree.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,10 @@ def test_error():
523523
X, y)
524524
assert_raises(ValueError, TreeEstimator(max_depth=-1).fit, X, y)
525525
assert_raises(ValueError, TreeEstimator(max_features=42).fit, X, y)
526-
assert_raises(ValueError, TreeEstimator(min_impurity_split=-1.0).fit,
527-
X, y)
526+
# min_impurity_split warning
527+
with ignore_warnings(category=DeprecationWarning):
528+
assert_raises(ValueError,
529+
TreeEstimator(min_impurity_split=-1.0).fit, X, y)
528530
assert_raises(ValueError,
529531
TreeEstimator(min_impurity_decrease=-1.0).fit, X, y)
530532

@@ -1237,7 +1239,8 @@ def test_arrays_persist():
12371239
# non-regression for #2726
12381240
for attr in ['n_classes', 'value', 'children_left', 'children_right',
12391241
'threshold', 'impurity', 'feature', 'n_node_samples']:
1240-
value = getattr(DecisionTreeClassifier().fit([[0], [1]], [0, 1]).tree_, attr)
1242+
value = getattr(DecisionTreeClassifier().fit([[0], [1]],
1243+
[0, 1]).tree_, attr)
12411244
# if pointing to freed memory, contents may be arbitrary
12421245
assert_true(-3 <= value.flat[0] < 3,
12431246
'Array points to arbitrary memory')

0 commit comments

Comments
 (0)