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

Skip to content

Commit 6717f99

Browse files
committed
TST Adapt test parametrization
Tests changed: - `test_affinity_propagation_convergence_warning_dense_sparse` Signed-off-by: Julien Jerphanion <[email protected]>
1 parent eda7b16 commit 6717f99

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sklearn/cluster/tests/test_affinity_propagation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import numpy as np
99
import pytest
10-
from scipy.sparse import csr_matrix
1110

1211
from sklearn.cluster import AffinityPropagation, affinity_propagation
1312
from sklearn.cluster._affinity_propagation import _equal_similarities_and_preferences
@@ -257,13 +256,14 @@ def test_affinity_propagation_random_state():
257256
assert np.mean((centers0 - centers76) ** 2) > 1
258257

259258

260-
@pytest.mark.parametrize("centers", [csr_matrix(np.zeros((1, 10))), np.zeros((1, 10))])
261-
def test_affinity_propagation_convergence_warning_dense_sparse(centers, global_dtype):
259+
@pytest.mark.parametrize("container", CSR_CONTAINERS + [np.array])
260+
def test_affinity_propagation_convergence_warning_dense_sparse(container, global_dtype):
262261
"""
263262
Check that having sparse or dense `centers` format should not
264263
influence the convergence.
265264
Non-regression test for gh-13334.
266265
"""
266+
centers = container(np.zeros((1, 10)))
267267
rng = np.random.RandomState(42)
268268
X = rng.rand(40, 10).astype(global_dtype, copy=False)
269269
y = (4 * rng.rand(40)).astype(int)

0 commit comments

Comments
 (0)