Пример #1
0
def test_time_throttle(values):
    """Test if lowpass filter works."""
    filt = TimeThrottleFilter(
        window_size=timedelta(minutes=2), 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, 18, 22] == [f.state for f in filtered]
Пример #2
0
 def test_time_throttle(self):
     """Test if lowpass filter works."""
     filt = TimeThrottleFilter(window_size=timedelta(minutes=2),
                               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, 18, 22] == [f.state for f in filtered]