Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f93ba89

Browse files
committed
troubleshooting for CI tests for #19304
1 parent 168e8d3 commit f93ba89

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

sklearn/ensemble/tests/test_forest.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,17 +1363,15 @@ def test_poisson_y_positive_check():
13631363
X = np.zeros((3, 3))
13641364

13651365
y = [-1, 1, 3]
1366-
with pytest.raises(
1367-
ValueError,
1368-
match="Some.*y are negative.*Poisson.*\."
1369-
):
1366+
err_msg = (r"Some value\(s\) of y are negative which is "
1367+
r"not allowed for Poisson regression.")
1368+
with pytest.raises(ValueError, match=err_msg):
13701369
est.fit(X, y)
13711370

13721371
y = [0, 0, 0]
1373-
with pytest.raises(
1374-
ValueError,
1375-
match="Sum of y is not positive.*Poisson regression\."
1376-
):
1372+
err_msg = (r"Sum of y is not strictly positive which "
1373+
r"is necessary for Poisson regression.")
1374+
with pytest.raises(ValueError, match=err_msg):
13771375
est.fit(X, y)
13781376

13791377
# mypy error: Variable "DEFAULT_JOBLIB_BACKEND" is not valid type

0 commit comments

Comments
 (0)