8000 TST: Run _preprocess_data on sparse without checks · scikit-learn/scikit-learn@952447a · GitHub
[go: up one dir, main page]

Skip to content

Commit 952447a

Browse files
committed
TST: Run _preprocess_data on sparse without checks
Make sure that even when checks are disabled, the sparse input still gets copied if requested.
1 parent 9a59e73 commit 952447a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sklearn/linear_model/tests/test_base.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,15 @@ def test_csr_preprocess_data():
321321
assert_equal(csr_.getformat(), 'csr')
322322

323323

324+
def test_csr_preprocess_data_no_checks():
325+
# Test output format of _preprocess_data, when input is csr
326+
X, y = make_regression()
327+
X[X < 2.5] = 0.0
328+
csr = sparse.csr_matrix(X)
329+
csr_, y, _, _, _ = _preprocess_data(csr, y, True, check_input=False)
330+
assert_equal(csr_.getformat(), 'csr')
331+
332+
324333
def test_dtype_preprocess_data():
325334
n_samples = 200
326335
n_features = 2

0 commit comments

Comments
 (0)
0