def test___eq___notEqual(filter, coeffs, state): actual = fo.Filter(coefficients=2 * coeffs, state=state) assert not filter == actual actual = fo.Filter(coefficients=coeffs, state=2 * state) assert not filter == actual actual = filter.copy() actual.comment = f'{actual.comment} A completely different thing' assert not filter == actual
def test_filter_comment(): filt = fo.Filter(coefficients=None, state=None, comment='Bla') assert filt.comment == 'Bla' filt.comment = 'Blub' assert filt.comment == 'Blub' filt.comment = 500 assert filt.comment == '500'
def filter(coeffs, state): """ Filter object. """ return fo.Filter(coefficients=coeffs, state=state)
def test_filter_init_empty_coefficients(): filt = fo.Filter(coefficients=None, state=None, sampling_rate=None) assert filt._coefficients is None assert filt._state is None assert filt.comment is None
def test_filter_init_with_state(): coeff = np.array([[[1, 0, 0], [1, 0, 0]]]) state = np.array([[[1, 0]]]) filt = fo.Filter(coefficients=coeff, state=state) npt.assert_array_equal(filt._coefficients, coeff) npt.assert_array_equal(filt._state, state)
def test_filter_init_empty_state(): coeff = np.array([[[1, 0, 0], [1, 0, 0]]]) filt = fo.Filter(coefficients=coeff, state=None) npt.assert_array_equal(filt._coefficients, coeff) assert filt._state is None
def test_filter_init(): coeff = np.array([[[1, 0, 0], [1, 0, 0]]]) filt = fo.Filter(coefficients=coeff, sampling_rate=None) npt.assert_array_equal(filt._coefficients, coeff)
def test_filter_init_empty_coefficients_with_state(): with pytest.raises(ValueError): fo.Filter(coefficients=None, state=[1, 0], sampling_rate=None)