File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 12
12
13
13
import numpy as np
14
14
import pytest
15
- from scipy import sparse
16
15
from scipy .cluster import hierarchy
17
16
from scipy .sparse .csgraph import connected_components
18
17
48
47
create_memmap_backed_data ,
49
48
ignore_warnings ,
50
49
)
50
+ from sklearn .utils .fixes import LIL_CONTAINERS
51
51
52
52
53
53
def test_linkage_misc ():
@@ -176,7 +176,8 @@ def test_agglomerative_clustering_distances(
176
176
assert not hasattr (clustering , "distances_" )
177
177
178
178
179
- def test_agglomerative_clustering (global_random_seed ):
179
+ @pytest .mark .parametrize ("lil_container" , LIL_CONTAINERS )
180
+ def test_agglomerative_clustering (global_random_seed , lil_container ):
180
181
# Check that we obtain the correct number of clusters with
181
182
# agglomerative clustering.
182
183
rng = np .random .RandomState (global_random_seed )
@@ -218,7 +219,7 @@ def test_agglomerative_clustering(global_random_seed):
218
219
# Check that we raise a TypeError on dense matrices
219
220
clustering = AgglomerativeClustering (
220
221
n_clusters = 10 ,
221
- connectivity = sparse . lil_matrix (connectivity .toarray ()[:10 , :10 ]),
222
+ connectivity = lil_container (connectivity .toarray ()[:10 , :10 ]),
222
223
linkage = linkage ,
223
224
)
224
225
with pytest .raises (ValueError ):
You can’t perform that action at this time.
0 commit comments