Skip to content

Commit

Permalink
TST Replaces pytest.warns(None) in test_feature_agglomeration (scikit…
Browse files Browse the repository at this point in the history
…-learn#22871)



Co-authored-by: Shan-Deng <[email protected]>
  • Loading branch information
ShanDeng123 and Shan-Deng authored Mar 17, 2022
1 parent e397f76 commit 0f38376
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions sklearn/cluster/tests/test_feature_agglomeration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""
# Authors: Sergul Aydore 2017
import numpy as np
import pytest

from numpy.testing import assert_array_equal
from sklearn.cluster import FeatureAgglomeration
Expand All @@ -17,12 +16,8 @@ def test_feature_agglomeration():

agglo_mean = FeatureAgglomeration(n_clusters=n_clusters, pooling_func=np.mean)
agglo_median = FeatureAgglomeration(n_clusters=n_clusters, pooling_func=np.median)
with pytest.warns(None) as record:
agglo_mean.fit(X)
assert not [w.message for w in record]
with pytest.warns(None) as record:
agglo_median.fit(X)
assert not [w.message for w in record]
agglo_mean.fit(X)
agglo_median.fit(X)

assert np.size(np.unique(agglo_mean.labels_)) == n_clusters
assert np.size(np.unique(agglo_median.labels_)) == n_clusters
Expand Down

0 comments on commit 0f38376

Please sign in to comment.