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 <noreply@anthropic.com>
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user