Skip to content

Commit 712b5b4

Browse files
TST replace pytest.warns(None) in metrics/cluster/test_supervised.py (scikit-learn#22955)
1 parent 37313ea commit 712b5b4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sklearn/metrics/cluster/tests/test_supervised.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import warnings
2+
13
import numpy as np
24
import pytest
35

@@ -456,9 +458,9 @@ def test_adjusted_rand_score_overflow():
456458
rng = np.random.RandomState(0)
457459
y_true = rng.randint(0, 2, 100_000, dtype=np.int8)
458460
y_pred = rng.randint(0, 2, 100_000, dtype=np.int8)
459-
with pytest.warns(None) as record:
461+
with warnings.catch_warnings():
462+
warnings.simplefilter("error", RuntimeWarning)
460463
adjusted_rand_score(y_true, y_pred)
461-
assert not [w.message for w in record]
462464

463465

464466
@pytest.mark.parametrize("average_method", ["min", "arithmetic", "geometric", "max"])

0 commit comments

Comments
 (0)