Skip to content

Commit 474cd98

Browse files
authored
TST Extend tests for scipy.sparse.*array in sklearn/decomposition/tests/test_pca.py (scikit-learn#27150)
1 parent a9611d0 commit 474cd98

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sklearn/decomposition/tests/test_pca.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
_get_check_estimator_ids,
2222
check_array_api_input_and_values,
2323
)
24+
from sklearn.utils.fixes import CSR_CONTAINERS
2425

2526
iris = datasets.load_iris()
2627
PCA_SOLVERS = ["full", "arpack", "randomized", "auto"]
@@ -502,9 +503,10 @@ def test_pca_svd_solver_auto(data, n_components, expected_solver):
502503

503504

504505
@pytest.mark.parametrize("svd_solver", PCA_SOLVERS)
505-
def test_pca_sparse_input(svd_solver):
506+
@pytest.mark.parametrize("csr_container", CSR_CONTAINERS)
507+
def test_pca_sparse_input(svd_solver, csr_container):
506508
X = np.random.RandomState(0).rand(5, 4)
507-
X = sp.sparse.csr_matrix(X)
509+
X = csr_container(X)
508510
assert sp.sparse.issparse(X)
509511

510512
pca = PCA(n_components=3, svd_solver=svd_solver)

0 commit comments

Comments
 (0)