diff --git a/goodwe_controller/test_safety119.py b/goodwe_controller/test_safety119.py index 0836f04..02c958c 100644 --- a/goodwe_controller/test_safety119.py +++ b/goodwe_controller/test_safety119.py @@ -53,6 +53,7 @@ import app.main as app_main # noqa: E402 from app import messages # noqa: E402 from app.main import Controller # noqa: E402 from app.p1 import make_sample, split_signed # noqa: E402 +from named_absence import first, nth, present # noqa: E402 fails = [] OPT0 = dict(s84.OPT) @@ -437,10 +438,10 @@ check(f"at 5 s, one bound cycle per turn: {M} are hidden, the {M + 1}th and " _hid == [True] * M + [False] * (20 - M)) _c = _C() _o, _ = turns(_c, 1.0, 2, 1, 12) -_first = next(t for t, h in _o if not h) +_first, _o0 = first(t for t, h in _o if not h), nth(_o, 0)[0] check(f"at 1 s the span holds too: not counted before {SPAN:.0f} s after " f"the first hidden one (counted at {_first:.0f} s)", - _o[0][0] + SPAN <= _first <= _o[0][0] + SPAN + 3.0 + present(_first, _o0) and _o0 + SPAN <= _first <= _o0 + SPAN + 3.0 and sum(h for _t, h in _o) > M) _c = _C() _t = 0.0