bazarr/libs/wraptor/context/test/test_throttle.py

18 lines
251 B
Python

import time
from wraptor.context import throttle
def test_basic():
arr = []
t = throttle(.1)
with t:
arr.append(1)
with t:
arr.append(1)
time.sleep(.2)
with t:
arr.append(1)
assert arr == [1, 1]