Skip to content

TST: replace pytest.warns(None) in test_plot_partial_dependence.py #23114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import pytest
from numpy.testing import assert_allclose
import warnings

from sklearn.datasets import load_diabetes
from sklearn.datasets import load_iris
Expand Down Expand Up @@ -770,7 +771,8 @@ def test_partial_dependence_display_deprecation(
with pytest.warns(FutureWarning, match=deprecation_msg):
disp.plot(pdp_lim=None)
# case when constructor and method parameters are different
with pytest.warns(None) as record:
with warnings.catch_warnings(record=True) as record:
warnings.simplefilter("always", FutureWarning)
disp.plot(pdp_lim=(0, 1))
assert len(record) == 2
for warning in record:
Expand Down