def test_kwargs(self): """Unexpected keywords""" with pytest.raises(KeyError): eeglcf._classify(1, 10, np.zeros([10] * 3), error=0) with pytest.raises(KeyError): eeglcf._classify(1, 10, feats=(np.zeros([10] * 3), ), error=0) with pytest.raises(KeyError): eeglcf._classify(1, 10)
def ctrl(ifeats): """Control signal""" return eeglcf._classify(1., 10, *ifeats)
def test_features(self): """features must be arrays""" # Specified as non-keyworded arguments with pytest.raises(KeyError): eeglcf._classify(1, 10) with pytest.raises(TypeError): eeglcf._classify(1, 10, [0, 1, 2]) with pytest.raises(TypeError): eeglcf._classify(1, 10, 'error') with pytest.raises(ValueError): eeglcf._classify(1, 10, np.zeros([2] * 4)) with pytest.raises(ValueError): eeglcf._classify(1, 10, np.zeros([2] * 2)) # Specified as keyworded a argument with pytest.raises(TypeError): eeglcf._classify(1, 10, feats=np.zeros([10] * 3)) # Multiple definition of features with pytest.raises(KeyError): eeglcf._classify(1, 10, np.zeros([10] * 3), feats=[ np.zeros([10] * 3), ])
def test_main(self, ifeats): """Functional test""" res = eeglcf._classify(1., 10, *ifeats) # Results must have the same shape as comps assert (res.shape == ifeats[0].shape)