Skip to content

Commit af6c35d

Browse files
authored
TST Extend tests for scipy.sparse.*array in sklearn/feature_selection/tests/test_sequential.py (scikit-learn#27178)
1 parent 8eef53f commit af6c35d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sklearn/feature_selection/tests/test_sequential.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import numpy as np
22
import pytest
3-
import scipy
43
from numpy.testing import assert_array_equal
54

65
from sklearn.cluster import KMeans
@@ -12,6 +11,7 @@
1211
from sklearn.neighbors import KNeighborsClassifier
1312
from sklearn.pipeline import make_pipeline
1413
from sklearn.preprocessing import StandardScaler
14+
from sklearn.utils.fixes import CSR_CONTAINERS
1515

1616

1717
def test_bad_n_features_to_select():
@@ -184,11 +184,12 @@ def test_sanity(seed, direction, n_features_to_select, expected_selected_feature
184184
assert_array_equal(sfs.get_support(indices=True), expected_selected_features)
185185

186186

187-
def test_sparse_support():
187+
@pytest.mark.parametrize("csr_container", CSR_CONTAINERS)
188+
def test_sparse_support(csr_container):
188189
# Make sure sparse data is supported
189190

190191
X, y = make_regression(n_features=10)
191-
X = scipy.sparse.csr_matrix(X)
192+
X = csr_container(X)
192193
sfs = SequentialFeatureSelector(
193194
LinearRegression(), n_features_to_select="auto", cv=2
194195
)

0 commit comments

Comments
 (0)