Example #1
0
def test_throttle(values):
    """Test if lowpass filter works."""
    filt = ThrottleFilter(window_size=3, precision=2, entity=None)
    filtered = []
    for state in values:
        new_state = filt.filter_state(state)
        if not filt.skip_processing:
            filtered.append(new_state)
    assert [20, 21] == [f.state for f in filtered]
Example #2
0
 def test_throttle(self):
     """Test if lowpass filter works."""
     filt = ThrottleFilter(window_size=3,
                           precision=2,
                           entity=None)
     filtered = []
     for state in self.values:
         new_state = filt.filter_state(state)
         if not filt.skip_processing:
             filtered.append(new_state)
     assert [20, 21] == [f.state for f in filtered]