From 57b0eb2f2095385f362048c8f00774bbe9d4ffbd Mon Sep 17 00:00:00 2001 From: "Claude (OPT-34 review)" Date: Sat, 31 Oct 2026 21:18:59 +0100 Subject: [PATCH] OPT-34 review: read the inverter in part 4 with a default test_named_absence.py flagged next() without a default (CI run 1473). Co-Authored-By: Claude Opus 5.5 --- goodwe_controller/test_opt34.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/goodwe_controller/test_opt34.py b/goodwe_controller/test_opt34.py index 516f55a..7e89e2e 100644 --- a/goodwe_controller/test_opt34.py +++ b/goodwe_controller/test_opt34.py @@ -616,11 +616,13 @@ check("B leaves the plan too: the latch is empty, so it is gone and " and lc.plan_targets() is None) latch_step(FC, charging, {A: 80.0}) lc.solar_fc = None -ia = next(i for i in lc.inverters if i.name == A) -ia.soc = 50.0 -st_below = homeview.plan_state(lc) -ia.soc = 80.0 -st_at = homeview.plan_state(lc) +ia = next((i for i in lc.inverters if i.name == A), None) +st_below = st_at = None +if ia is not None: + ia.soc = 50.0 + st_below = homeview.plan_state(lc) + ia.soc = 80.0 + st_at = homeview.plan_state(lc) check("the screen says the charge goes on only while the latched battery is " f"below its level ({st_below!r} at 50 %, {st_at!r} at 80 %)", st_below == "latched" and st_at == "no_forecast")