def test_blending_transform_wrong_dim(): """Check if returns error when number of spatial dimension changed""" X = np.ones((1, 10, 2)) Blend = Blending(window_overlap=10) Blend.fit(X) with pytest.raises( ValueError, match='X.shape should be \(n_trials, n_samples, n_electrodes\).'): Blend.transform(np.ones((10, 2)))
def test_blending_NaN(): """Check if returns error when NaN""" X = np.ones((1, 10, 2)) X[0, 5, 1] = np.NaN Blend = Blending(window_overlap=10) with pytest.raises( ValueError, match= 'Input contains NaN, infinity or a value too large for dtype\(\'float64\'\).' ): Blend.fit(X) X2 = np.ones((1, 10, 3)) Blend.fit(X2) with pytest.raises( ValueError, match= 'Input contains NaN, infinity or a value too large for dtype\(\'float64\'\).' ): Xtransform = Blend.transform(X)
def test_blending_not_init(): with pytest.raises(ValueError, match="window_overlap parameter is not initialized."): Blending(window_overlap=None)