def test_initial_outlier(values): """Test issue #13363.""" filt = OutlierFilter(window_size=3, precision=2, entity=None, radius=4.0) out = ha.State("sensor.test_monitored", 4000) for state in [out] + values: filtered = filt.filter_state(state) assert filtered.state == 21
def test_outlier(self): """Test if outlier filter works.""" filt = OutlierFilter(window_size=3, precision=2, entity=None, radius=4.0) for state in self.values: filtered = filt.filter_state(state) assert 21 == filtered.state
def test_outlier(self): """Test if outlier filter works.""" filt = OutlierFilter(window_size=3, precision=2, entity=None, radius=4.0) for state in self.values: filtered = filt.filter_state(state) assert 21 == filtered.state
def test_unknown_state_outlier(values): """Test issue #32395.""" filt = OutlierFilter(window_size=3, precision=2, entity=None, radius=4.0) 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 == 21
def test_initial_outlier(self): """Test issue #13363.""" filt = OutlierFilter(window_size=3, precision=2, entity=None, radius=4.0) out = ha.State('sensor.test_monitored', 4000) for state in [out]+self.values: filtered = filt.filter_state(state) assert 21 == filtered.state
def test_outlier_step(values): """ Test step-change handling in outlier. Test if outlier filter handles long-running step-changes correctly. It should converge to no longer filter once just over half the window_size is occupied by the new post step-change values. """ filt = OutlierFilter(window_size=3, precision=2, entity=None, radius=1.1) values[-1].state = 22 for state in values: filtered = filt.filter_state(state) assert filtered.state == 22
def test_outlier_step(self): """ Test step-change handling in outlier. Test if outlier filter handles long-running step-changes correctly. It should converge to no longer filter once just over half the window_size is occupied by the new post step-change values. """ filt = OutlierFilter(window_size=3, precision=2, entity=None, radius=1.1) self.values[-1].state = 22 for state in self.values: filtered = filt.filter_state(state) assert 22 == filtered.state