Fixing the positional parameter naming + unit tests updated
This commit is contained in:
parent
8411844d7e
commit
4945331093
@ -379,7 +379,7 @@ def main() -> None:
|
|||||||
throttle(
|
throttle(
|
||||||
_process,
|
_process,
|
||||||
min_secs=_CONF['internals'].get('process_throttle_secs', 10),
|
min_secs=_CONF['internals'].get('process_throttle_secs', 10),
|
||||||
dynamic_whitelist=args.dynamic_whitelist,
|
nb_assets=args.dynamic_whitelist,
|
||||||
)
|
)
|
||||||
old_state = new_state
|
old_state = new_state
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
@ -16,15 +16,33 @@ def test_throttle():
|
|||||||
return 42
|
return 42
|
||||||
|
|
||||||
start = time.time()
|
start = time.time()
|
||||||
result = throttle(func, 0.1)
|
result = throttle(func, min_secs = 0.1)
|
||||||
end = time.time()
|
end = time.time()
|
||||||
|
|
||||||
assert result == 42
|
assert result == 42
|
||||||
assert end - start > 0.1
|
assert end - start > 0.1
|
||||||
|
|
||||||
result = throttle(func, -1)
|
result = throttle(func, min_secs = -1)
|
||||||
assert result == 42
|
assert result == 42
|
||||||
|
|
||||||
|
def test_throttle_with_assets():
|
||||||
|
|
||||||
|
def func(nb_assets = -1):
|
||||||
|
return nb_assets
|
||||||
|
|
||||||
|
start = time.time()
|
||||||
|
result = throttle(func, min_secs = 0.1, nb_assets = 666)
|
||||||
|
end = time.time()
|
||||||
|
|
||||||
|
assert result == 666
|
||||||
|
|
||||||
|
start = time.time()
|
||||||
|
result = throttle(func, min_secs = 0.1)
|
||||||
|
end = time.time()
|
||||||
|
|
||||||
|
assert result == -1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_parse_args_defaults():
|
def test_parse_args_defaults():
|
||||||
args = parse_args([])
|
args = parse_args([])
|
||||||
|
Loading…
Reference in New Issue
Block a user