OPT-34 review: read the inverter in part 4 with a default
checks / unit (pull_request) Successful in 23m57s
infra-pin / fresh (pull_request) Successful in 2s

test_named_absence.py flagged next() without a default (CI run 1473).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude (OPT-34 review)
2026-10-31 21:18:59 +01:00
parent 8f0af9f318
commit 57b0eb2f20
+7 -5
View File
@@ -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")