diff --git a/goodwe_controller/test_opt36.py b/goodwe_controller/test_opt36.py index 4001e60..869161c 100644 --- a/goodwe_controller/test_opt36.py +++ b/goodwe_controller/test_opt36.py @@ -44,7 +44,7 @@ sys.path.insert(0, HERE) sys.path.insert(0, os.path.join(HERE, "tools")) logging.disable(logging.WARNING) -from named_absence import nth # noqa: E402 +from named_absence import nth, present # noqa: E402 import ux54_scenarios as S # noqa: E402 import opt11p3_replay as rp # noqa: E402 import app.main as m # noqa: E402 @@ -793,12 +793,14 @@ check("mid night: A's commands follow the levels: it charges to its level " md["soc"][0] < 85.0 and abs(md["soc"][0] - m2["target_a"]) < 0.5) check("mid night: B fills as before (to the ceiling)", md["soc"][1] > 94.0) mf = R["mid_flat"] -lv_f = {mk["target_a"] for mk in mf["marks"].values()} -print(f" mid_flat: A level(s) {sorted(lv_f)}; A ends {mf['soc'][0]:.2f} %") +lv_f = [mk["target_a"] for mk in mf["marks"].values()] +lv0 = nth(lv_f, 0) +print(f" mid_flat: A level(s) {sorted(set(map(str, lv_f)))}; A ends " + f"{mf['soc'][0]:.2f} %") check("one figure all night: A's level never moves (round 2: 55 -> 69 -> " "41 -> 37 %), A charges to it and stops (round 2: 56 %)", - len(lv_f) == 1 and None not in lv_f - and abs(mf["soc"][0] - next(iter(lv_f))) < 0.5) + present(lv0) and lv0 is not None and len(set(lv_f)) == 1 + and abs(mf["soc"][0] - lv0) < 0.5) fd = R["f1_dark_b"] dk = fd["marks"] held = [dk[h]["target_a"] for h in dk if "05:15" <= h < "07:00"]