def test_stale_timestamp(self): size = 10 step = 5 expires = 20 now_timestamp = 60 window = SlidingWindow(size, step, expires=expires) for time in range(0, now_timestamp - expires): print('TIME: %r NOW TIMESTAMP: %r' % (time, now_timestamp)) assert window.stale(time, now_timestamp) is True
def test_non_stale_timestamp(self): size = 10 step = 5 expires = 20 now_timestamp = 60 window = SlidingWindow(size, step, expires=expires) for time in range(now_timestamp - expires + 1, now_timestamp): assert window.stale(time, now_timestamp) is False