8000 TST improve coverage of fastica function (#15102) · scikit-learn/scikit-learn@a07392f · GitHub
[go: up one dir, main page]

Skip to content

Commit a07392f

Browse files
NicolasHugrth
authored andcommitted
TST improve coverage of fastica function (#15102)
1 parent c4f372c commit a07392f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

sklearn/decomposition/tests/test_fastica.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,22 @@ def test_fastica_errors():
280280
with pytest.raises(ValueError, match='Invalid algorithm.+must '
281281
'be.+parallel.+or.+deflation'):
282282
fastica(X, algorithm='pizza')
283+
284+
285+
@pytest.mark.parametrize('whiten', [True, False])
286+
@pytest.mark.parametrize('return_X_mean', [True, False])
287+
@pytest.mark.parametrize('return_n_iter', [True, False])
288+
def test_fastica_output_shape(whiten, return_X_mean, return_n_iter):
289+
n_features = 3
290+
n_samples = 10
291+
rng = np.random.RandomState(0)
292+
X = rng.random_sample((n_samples, n_features))
293+
294+
expected_len = 3 + return_X_mean + return_n_iter
295+
296+
out = fastica(X, whiten=whiten, return_n_iter=return_n_iter,
297+
return_X_mean=return_X_mean)
298+
299+
assert len(out) == expected_len
300+
if not whiten:
301+
assert out[0] is None

0 commit comments

Comments
 (0)
0