def test_lowpass(self): """Test if lowpass filter works.""" filt = LowPassFilter(window_size=10, precision=2, entity=None, time_constant=10) for state in self.values: filtered = filt.filter_state(state) assert 18.05 == filtered.state
def test_precision_zero(values): """Test if precision of zero returns an integer.""" filt = LowPassFilter(window_size=10, precision=0, entity=None, time_constant=10) for state in values: filtered = filt.filter_state(state) assert isinstance(filtered.state, int)
def test_lowpass(self): """Test if lowpass filter works.""" filt = LowPassFilter(window_size=10, precision=2, entity=None, time_constant=10) for state in self.values: filtered = filt.filter_state(state) assert 18.05 == filtered.state
def test_lowpass(values): """Test if lowpass filter works.""" filt = LowPassFilter(window_size=10, precision=2, entity=None, time_constant=10) out = ha.State("sensor.test_monitored", "unknown") for state in [out] + values + [out]: try: filtered = filt.filter_state(state) except ValueError: assert state.state == "unknown" assert filtered.state == 18.05