test(edge): add genuine EventEngine cooldown primitive test
This commit is contained in:
parent
e8e24c266f
commit
e801c7d057
1 changed files with 9 additions and 0 deletions
|
|
@ -47,3 +47,12 @@ def test_cooldown_suppresses_duplicate():
|
|||
_lying_track(tr, 0.7)
|
||||
again = eng.process([tr], [], now=0.7)
|
||||
assert all(e.event_type != EventType.FALL for e in again)
|
||||
|
||||
def test_allow_cooldown_primitive():
|
||||
eng = _engine() # EngineConfig(camera_id="cam-01", cooldown_s=30.0)
|
||||
key = ("FALL", 1)
|
||||
assert eng._allow(key, now=0.0) is True # first time allowed
|
||||
assert eng._allow(key, now=5.0) is False # within cooldown -> suppressed
|
||||
assert eng._allow(key, now=40.0) is True # after cooldown_s elapsed -> allowed again
|
||||
# a different key is independent
|
||||
assert eng._allow(("FALL", 2), now=5.0) is True
|
||||
|
|
|
|||
Loading…
Reference in a new issue