Skip to content

Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.

fix(video): held_verdict refuses by name a cut held on one step whose record names no line it was read on, as a public caller may be handed one

Soohong Kim64c9cef19a95
diff --git a/sprite_gen/video/local_cycle.py b/sprite_gen/video/local_cycle.py
index 9aa6c37..17f19cd 100644
--- a/sprite_gen/video/local_cycle.py
+++ b/sprite_gen/video/local_cycle.py
@@ -1027,7 +1027,9 @@ def step_verdict(cycle):
def held_verdict(cycle):
"""The body's word on the cut, where it holds it (`cut_witness`, loop `_witnessed`), in words: a cut nothing
witnesses whole cycles, or one the body rises and falls once in — one step of a walk, or a whole cycle of a body
- that does so once a cycle — kept as it was chosen, each line's reading named (CUT_LINES). Each names UNWITNESSED."""
+ that does so once a cycle — kept as it was chosen, each line's reading named (CUT_LINES). Each names UNWITNESSED.
+ A cut held on one step whose record names no line it was read on (no `by` or `lines`) is refused by name
+ (ValueError): the line it rose and fell once on cannot be named."""
said = cycle.get('cut_witness') or {}
if said.get('held') != 'unwitnessed':
return []
@@ -1040,6 +1042,10 @@ def held_verdict(cycle):
return [f"nothing that reads no leg witnesses the cut {s}/{L} whole cycles ({said['why']}): {basis} — where the "
f"walk's legs are drawn alike, a step loops as a cycle does, and the loop may be half its cycle "
f"({UNWITNESSED})"]
+ if 'by' not in said or 'lines' not in said:
+ raise ValueError(f"the cut witness of {s}/{L} says one step and names no line it was read on (no `by` or "
+ "`lines`): held_verdict names the line a cut held on one step rose and fell once on, as "
+ "cut_word records it (CUT_LINES); cut the loop again to have its witness so recorded")
on = said['on']
where = ' and '.join(CUT_LINES[line] for line in said['by'])
rest = ''.join(f", and {CUT_LINES[line]} it says nothing ({word['why']})" for line, word in said['lines'].items()
diff --git a/tests/video/test_walk_steps.py b/tests/video/test_walk_steps.py
index 68d61d6..aeacc1a 100644
--- a/tests/video/test_walk_steps.py
+++ b/tests/video/test_walk_steps.py
@@ -1141,6 +1141,23 @@ def test_a_cut_is_witnessed_by_how_often_the_body_rises_and_falls_in_it(beat, sa
assert word["on"]["says"] == "cycles" and word["on"]["interval"] == {"four steps": 8, "one step": 32}[says]
[email protected]("verdict", ["held_verdict", "step_verdict"])
+def test_a_cut_held_on_one_step_whose_record_names_no_line_is_refused_by_name(verdict):
+ """`held_verdict` (a public caller; `step_verdict` says it) names the line a cut held on one step rose and fell
+ once on (`by`, `lines`). A record held on one step that names no line it was read on, its reading over the feet
+ kept at its top (`bob`, `on`), is refused by name (ValueError); one held with nothing read names its own why as
+ before."""
+ once, still = local_cycle.cut_word(_bob(16), 16), local_cycle.cut_word(_bob(None), 16)
+ feet = once["lines"]["feet"]
+ one_step = {"cut": [0, 16], "says": "one step", "bob": feet["bob"], "on": feet["on"], "held": "unwitnessed"}
+ with pytest.raises(ValueError, match="names no line it was read on"):
+ getattr(local_cycle, verdict)({"start": 0, "length": 16, "cut_witness": one_step})
+ why = still["lines"]["feet"]["why"]
+ nothing = {"cut": [0, 16], "says": None, "bob": still["lines"]["feet"]["bob"], "why": why, "held": "unwitnessed"}
+ said = getattr(local_cycle, verdict)({"start": 0, "length": 16, "cut_witness": nothing})
+ assert len(said) == 1 and why in said[0] and local_cycle.UNWITNESSED in said[0]
+
+
def test_a_shadow_on_the_screen_under_the_feet_does_not_hold_a_shaken_picture_still_for_the_witness():
"""`bob_word` on an interval of 15 frames, the body 100 rows tall on a picture moved 3 rows up and down twice an
interval: its top line and its feet move with the picture, but a shadow drawn translucent under the feet and fixed