TEST-26: a missing value in a check is a named FAIL, not a traceback
checks / unit (pull_request) Successful in 8m44s
checks / unit (pull_request) Successful in 8m44s
Checks and prints that indexed an empty list, exhausted next(), or formatted None killed the rest of their file (FCST-06). Read them through the new named_absence.py (nth/first/field/given/present) and conjoin a presence term. - every site in the brief, plus the family the new scan and a sweep found - test_named_absence.py: scans every test_*.py for unguarded filtered-list indexing, next() without a default and numeric formats on maybe-None names; proven to bite; prints what it cannot see, counted - test_price.py 16a: the `_T17_CAPS is _T17_CAPS` tautology now grades the two assemble() calls' arguments - test_control.py: coverage table re-measured on runs graded to the end Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BwRLw7eKYj2byVdwB6kbjU
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a45ed06c05
commit
770988c902
@@ -36,6 +36,7 @@ from math import inf
|
||||
from pathlib import Path
|
||||
|
||||
from app import arbitrage, packshare
|
||||
from named_absence import first, nth, present
|
||||
from app.allocator import plan
|
||||
from app.arbiter import (
|
||||
ACTUATOR_SITE, CLAIM_SCOPE, P_LOOP, P_SAFETY, SCOPE_UNIT, Claim, resolve,
|
||||
@@ -347,12 +348,12 @@ check("...and the shipped behaviour really was the other one, so the line "
|
||||
"above is not vacuous: an equal split of 1500 W is 750/750, and 750 W is "
|
||||
"what a pack at its cut-out was being told to produce",
|
||||
_r_now.shares == {A: 750, Bee: 750})
|
||||
_plan_a = next(p for p in _r_opt.allocation.plans if p.unit == A)
|
||||
_plan_a = first((p for p in _r_opt.allocation.plans if p.unit == A), "no plan for A")
|
||||
print(f" {_plan_a.explain()}")
|
||||
check("...and the RECORD says why, in the line an operator is already reading. "
|
||||
"`UnitPlan.within_envelope` is asked rather than assumed, and SAFETY-28's "
|
||||
"write gate refuses a record that contradicts itself",
|
||||
_plan_a.within_envelope and _plan_a.share_w == 0
|
||||
present(_plan_a) and _plan_a.within_envelope and _plan_a.share_w == 0
|
||||
and _plan_a.hi == 0.0 and _r_opt.allocated)
|
||||
check("a pack at 100 % is not allocated a CHARGE either, and the sibling takes "
|
||||
"the whole of it - the same sentence in the other direction",
|
||||
@@ -477,12 +478,12 @@ check("...and the two halves are separated from EACH OTHER as well: on a pack "
|
||||
"grades the ENVELOPE. Case three - both packs with room, nothing closed - "
|
||||
"is the one that can only be the WEIGHTS",
|
||||
_env_only.shares == {A: 0, Bee: 1500}
|
||||
and _broken[2][1] != _broken[2][2])
|
||||
and len(_broken) > 2 and _broken[2][1] != _broken[2][2])
|
||||
check("...and the third case is the one that isolates the WEIGHTS from the "
|
||||
"ENVELOPE: both packs have room, no interval is closed, nothing is "
|
||||
"refused - and the split still moves from 500/500 to 97/903 because the "
|
||||
"energy headroom says so",
|
||||
_broken[2][1] == {A: 97, Bee: 903} and _broken[2][2] == {A: 500, Bee: 500})
|
||||
nth(_broken, 2)[1] == {A: 97, Bee: 903} and nth(_broken, 2)[2] == {A: 500, Bee: 500})
|
||||
|
||||
|
||||
# ==============================================================================
|
||||
@@ -1156,7 +1157,7 @@ check("⚠️ MAIN.PY ACTUALLY PASSES `weights=`, AND IT PASSES THE METHOD RATHE
|
||||
# reads the allocation's own `unmet_w`, is EDGE-TRIGGERED against the previous
|
||||
# cycle's value, and logs. What it does NOT grade is the sentence it logs or
|
||||
# that a real cycle reaches it; that is stated here rather than implied.
|
||||
_cycle_src = next(
|
||||
_cycle_src = first(
|
||||
f for cls in ast.walk(ast.parse(
|
||||
(Path(__file__).resolve().parent / "app" / "main.py")
|
||||
.read_text(encoding="utf-8")))
|
||||
|
||||
Reference in New Issue
Block a user