Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.
test: a plain pytest is the fast bundle — the slow tests marked, three tests that measured another's branch removed, and `pytest --full` and the release lane run every test
Soohong Kim99e5dd11740a
diff --git a/pyproject.toml b/pyproject.tomlindex 4ed2a38..ad2a76e 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -73,8 +73,11 @@ pythonpath = ["tests"]timeout = 120# One mark names a test of the real rife-ncnn-vulkan: tests/conftest.py skips it where no RIFE is# reachable, and `scripts/linux_lane.sh --rife-only` runs exactly the marked tests (`-m real_rife`).+# The other names a slow test: a plain `pytest` is the fast bundle, which tests/conftest.py makes by+# deselecting the marked tests, and `pytest --full` runs every test, as the release lane does.markers = ["real_rife: runs the real rife-ncnn-vulkan; skipped where none is reachable, run by `scripts/linux_lane.sh --rife-only`",+ "slow: a case takes 1 s or more, or the function's cases 5 s or more together (an 8-core M1); deselected unless `pytest --full`",]# The pipeline ships an importable sprite_gen package. The canonical invocation is thediff --git a/scripts/linux_lane.sh b/scripts/linux_lane.shindex ada08cb..da6e9b2 100755--- a/scripts/linux_lane.sh+++ b/scripts/linux_lane.sh@@ -121,8 +121,9 @@ if [ "$rife_only" = 1 ]; thenstep "RIFE tests (every test marked real_rife, none skipped)"rife_log=$(mktemp)trap 'rm -f "$rife_log"' EXIT- # No test marked: pytest exits 5 ("no tests ran"), and the lane with it.- .venv/bin/python -m pytest -q -rs -m real_rife | tee "$rife_log"+ # No test marked: pytest exits 5 ("no tests ran"), and the lane with it. --full: a marked test that is+ # also marked slow runs too.+ .venv/bin/python -m pytest -q -rs --full -m real_rife | tee "$rife_log"! grep -E '^SKIPPED' "$rife_log" >/dev/null || fail "a RIFE test skipped; this run is meant to measure them"echo "linux_lane: the RIFE gates passed at $sha"exit 0@@ -152,8 +153,9 @@ test -f "$smoke/run/sprite-sheet-alpha.png"test -f "$smoke/run/manifest.json"step "tests"-# Without RIFE, a skip of a test not marked real_rife fails unless tests/conftest.py names it.-.venv/bin/python -m pytest -q ${rife_unmeasured:+--rife-unmeasured}+# Every test (--full): a plain pytest is the fast bundle, the tests marked slow deselected. Without RIFE, a+# skip of a test not marked real_rife fails unless tests/conftest.py names it.+.venv/bin/python -m pytest -q --full ${rife_unmeasured:+--rife-unmeasured}if [ -n "$rife_unmeasured" ]; thenecho "linux_lane: every gate but RIFE passed at $sha"diff --git a/tests/audio/test_sound.py b/tests/audio/test_sound.pyindex f4a014a..0479d05 100644--- a/tests/audio/test_sound.py+++ b/tests/audio/test_sound.py@@ -78,6 +78,7 @@ def bundle(tmp_path, monkeypatch, name, seconds):cache_dir=tmp_path/'cache', out_dir=tmp_path/'out')@pytest.mark.parametrize('name', HITS)def test_short_hits_pass_the_one_loudness_rule(tmp_path, monkeypatch, name):result = bundle(tmp_path, monkeypatch, name, HITS[name]['seconds'])@@ -262,6 +263,7 @@ def test_cache_serializes_paid_requests_and_survives_uncertain_results(tmp_path)cache.obtain(db, {'a':2}, lambda: pytest.fail('ambiguous POST resent'))def test_actual_exports_are_normalized_and_reused(tmp_path, monkeypatch):called = []monkeypatch.setattr(provider, 'generate', lambda req: (called.append(req) or wav_bytes(), {}))@@ -291,6 +293,7 @@ def test_processing_failure_reuses_paid_audio(tmp_path, monkeypatch):assert sound.generate(**kw)['cache_hit'] and len(called) == 1@pytest.mark.parametrize('kind,duration,loop', [('sfx', .5, False), ('bgm', 3, True)])def test_short_effect_and_loop_encoded_playback(tmp_path, monkeypatch, kind, duration, loop):monkeypatch.setattr(provider, 'generate', lambda req: (wav_bytes(duration), {}))@@ -403,6 +406,7 @@ def test_export_reserves_overlap_for_minimum_playback_rate(tmp_path, monkeypatchprocessing.export(tmp_path/'source', tmp_path, target_lufs=-20, loop=True, crossfade=overlap/48000)@pytest.mark.parametrize('millisecond_timescale', [False, True])def test_m4a_container_preserves_declared_frames(tmp_path, monkeypatch, millisecond_timescale):frames = 144003@@ -437,6 +441,7 @@ def test_missing_ffprobe_preflights_before_generation(tmp_path, monkeypatch):cache_dir=tmp_path/'cache', out_dir=tmp_path/'out')def test_old_processed_output_is_rejected_but_raw_cache_survives(tmp_path, monkeypatch):calls = []monkeypatch.setattr(provider, 'generate', lambda req: (calls.append(req) or wav_bytes(), {}))diff --git a/tests/compose/test_game_pack.py b/tests/compose/test_game_pack.pyindex 29635a0..d3870fd 100644--- a/tests/compose/test_game_pack.py+++ b/tests/compose/test_game_pack.py@@ -45,6 +45,7 @@ def pixels(out, result, animation):return found@pytest.mark.parametrize("scale,resample", [(0.16, None), (0.5, "lanczos")])def test_scaled_cutout_carries_no_colour_its_source_did_not_have(tmp_path, scale, resample):src = figure()diff --git a/tests/conftest.py b/tests/conftest.pyindex 7bee36d..21a5988 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -75,11 +75,30 @@ def pytest_addoption(parser: pytest.Parser) -> None:help="the RIFE-less run of scripts/linux_lane.sh: a skip fails unless its test is marked real_rife ""or named in NOT_RIFE_SKIPS (tests/conftest.py)",)+ parser.addoption(+ "--full",+ action="store_true",+ help="run every test; without it a run is the fast bundle, the tests marked slow deselected. "+ "The release lane (scripts/linux_lane.sh) runs with it",+ )+++def pytest_report_header(config: pytest.Config) -> str | None:+ if not config.getoption("full"):+ return "fast bundle: the tests marked slow are deselected; `pytest --full` runs every test"+ return None++def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]) -> None:+ """Without `--full` the tests marked `slow` are deselected: a plain `pytest` is the fast bundle.-def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:- """A test marked `real_rife` runs the real binary: skipped where `rife.locate()` finds none, and run+ A test marked `real_rife` runs the real binary: skipped where `rife.locate()` finds none, and runby `scripts/linux_lane.sh --rife-only` (`-m real_rife`)."""+ if not config.getoption("full"):+ slow = [item for item in items if item.get_closest_marker("slow")]+ if slow:+ config.hook.pytest_deselected(items=slow)+ items[:] = [item for item in items if not item.get_closest_marker("slow")]marked = [item for item in items if item.get_closest_marker("real_rife")]if not marked:returndiff --git a/tests/curate/test_anchor_selection.py b/tests/curate/test_anchor_selection.pyindex 5027a1d..42d3888 100644--- a/tests/curate/test_anchor_selection.py+++ b/tests/curate/test_anchor_selection.py@@ -12,6 +12,7 @@from __future__ import annotationsimport json+import shutilimport sysfrom pathlib import Path@@ -112,20 +113,38 @@ def _request(run_dir: Path) -> dict:return json.loads((run_dir / "sprite-request.json").read_text(encoding="utf-8"))+def _copy_run(built: Path, tmp_path: Path) -> Path:+ """모듈이 한 번 추출한 런의 사본 — 테스트는 제 사본만 고친다."""+ run_dir = tmp_path / "run"+ shutil.copytree(built, run_dir)+ return run_dir+++# 추출이 테스트 시간의 거의 전부다(런 하나에 1.5~2.6 s): 모듈에서 런마다 한 번 추출하고 테스트마다 복사한다.[email protected](scope="module")+def _direction_built(tmp_path_factory: pytest.TempPathFactory) -> Path:+ return _build_direction_run(tmp_path_factory.mktemp("direction"))++[email protected](scope="module")+def _stage1_built(tmp_path_factory: pytest.TempPathFactory) -> Path:+ return _build_direction_run(tmp_path_factory.mktemp("stage1"), extract_states="down_idle,side_idle")++@pytest.fixture-def direction_run(tmp_path: Path) -> Path:- return _build_direction_run(tmp_path)+def direction_run(_direction_built: Path, tmp_path: Path) -> Path:+ return _copy_run(_direction_built, tmp_path)@pytest.fixture-def stage1_run(tmp_path: Path) -> Path:+def stage1_run(_stage1_built: Path, tmp_path: Path) -> Path:"""**워크플로 stage-1 그대로**: 방향 앵커 행만 생성·추출됐고 액션 행은 아직 없다.앵커 소비자는 정의상 이 구간에서 돈다 (stage-2 행을 생성하려면 그 방향 앵커 ref 가먼저 필요하다). 플랜 초기 픽스처가 전부 '완전 추출된 런'이라 이 구간을 한 건도덮지 않았고, 그래서 `require_frames_manifest`(완성 소비자 게이트) 오사용이테스트를 통과했다 — validator 검증 2026-07-25 reject 의 근본 원인."""- return _build_direction_run(tmp_path, extract_states="down_idle,side_idle")+ return _copy_run(_stage1_built, tmp_path)@pytest.fixture@@ -390,6 +409,7 @@ def _post_curation(run_dir: Path, body: dict) -> int:srv.shutdown()def test_view_save_cannot_launder_a_stale_pin(direction_run: Path) -> None:"""뷰 저장(무관한 편집)이 낡은 핀을 현재 세대로 **세탁하지 못한다**.@@ -418,6 +438,7 @@ def test_view_save_cannot_launder_a_stale_pin(direction_run: Path) -> None:assert excinfo.value.kind == "pick-stale-generation"def test_explicit_repin_clears_the_stale_pin(direction_run: Path) -> None:"""푸는 길은 **명시 재지정**뿐이다 (뷰의 stale 핀 버튼이 `repin: true` 를 싣는다)."""from sprite_gen.curate.curation import load_curation_reportdiff --git a/tests/curate/test_curation_salvage_and_clones.py b/tests/curate/test_curation_salvage_and_clones.pyindex 47b27fd..89ea3c3 100644--- a/tests/curate/test_curation_salvage_and_clones.py+++ b/tests/curate/test_curation_salvage_and_clones.py@@ -21,6 +21,7 @@import jsonfrom pathlib import Path+import pytestfrom PIL import Imagefrom conftest import run_script@@ -140,6 +141,7 @@ def test_legacy_unstamped_sidecar_drops_all_and_the_save_backs_it_up(fixture_runassert backup and (run / backup).read_text(encoding="utf-8") == original_textdef test_take_append_prefix_rule(tmp_path: Path) -> None:"""테이크가 뒤에 추가돼도(현재 세그먼트의 접두) 기존 행 큐레이션은 유효하다.takes 는 pixel_perfect 계약이므로 pp 런을 test_takes_heal 과 같은 방식으로 만든다."""diff --git a/tests/curate/test_snap_phase_policy.py b/tests/curate/test_snap_phase_policy.pyindex 63435d8..3229e4f 100644--- a/tests/curate/test_snap_phase_policy.py+++ b/tests/curate/test_snap_phase_policy.py@@ -17,6 +17,7 @@ import randomimport shutilfrom pathlib import Path+import pytestfrom PIL import Imagefrom conftest import run_script@@ -76,6 +77,7 @@ def _build_run(run_dir: Path, frames: int = 2) -> Image.Image:return artdef test_extraction_keeps_every_logical_cell_when_the_true_phase_is_offset(tmp_path: Path) -> None:"""위상이 비영인 판을 추출해도 논리 칸 수가 한 칸도 줄지 않아야 한다.diff --git a/tests/effects/test_breathe_smooth.py b/tests/effects/test_breathe_smooth.pyindex 30aeaaf..47122a9 100644--- a/tests/effects/test_breathe_smooth.py+++ b/tests/effects/test_breathe_smooth.py@@ -124,6 +124,7 @@ def test_a_cell_at_phase_zero_is_byte_identical_to_its_source() -> None:# ── 2. 머리 자리·바이트 고정 ───────────────────────────────────────@pytest.mark.parametrize("h", [120, 1000], ids=["small", "1000px"])def test_the_head_stays_in_place_byte_for_byte(h: int) -> None:src = _bust(h)@@ -178,6 +179,7 @@ def _rise(src, got, row, col, reach) -> float:return _mark_row(src, row, col, reach) - _mark_row(got, row, col, reach)@pytest.mark.parametrize("h", [120, 1000], ids=["small", "1000px"])def test_the_chest_rises_by_depth_and_settles_back(h: int) -> None:src, anat, cfg, rows, cols = _marked(h)diff --git a/tests/frames/test_chroma_key_relative.py b/tests/frames/test_chroma_key_relative.pyindex a1b68f5..3f6963a 100644--- a/tests/frames/test_chroma_key_relative.py+++ b/tests/frames/test_chroma_key_relative.py@@ -286,6 +286,7 @@ def test_border_candidate_rule_still_rejects_subject_colours_and_non_keys() -> Nassert detect_background_key_rgb(make_flat_key_still(colour), GREEN) == GREENdef test_the_lean_green_widens_only_the_green_key_and_only_toward_green() -> None:"""The colours the leaning-green branch adds, over the whole RGB cube: none for magenta (a key withone unkeyed channel keeps that channel dark — hot pink's 77 included), none dropped for either key,diff --git a/tests/frames/test_grid_record_exactness.py b/tests/frames/test_grid_record_exactness.pyindex be1ac44..cef353c 100644--- a/tests/frames/test_grid_record_exactness.py+++ b/tests/frames/test_grid_record_exactness.py@@ -17,6 +17,7 @@ from __future__ import annotationsimport jsonimport random+import pytestfrom PIL import Imageimport sprite_gen.frames.extract as extract_module@@ -113,6 +114,7 @@ def test_twin_footprint_matches_the_final_frame_exactly(tmp_path) -> None:assert checked, "쌍둥이를 한 장도 검사하지 못했다"def test_grid_record_stays_exact_across_pitches_and_cells(tmp_path) -> None:"""정수/비정수 피치·여러 셀 크기에서 두 불변식이 함께 성립한다.diff --git a/tests/frames/test_heal_async.py b/tests/frames/test_heal_async.pyindex 21e4006..1342001 100644--- a/tests/frames/test_heal_async.py+++ b/tests/frames/test_heal_async.py@@ -43,6 +43,7 @@ def _noop_report(run_dir):return {"healed": [], "kept_stale": [], "failed": [], "notes": []}def test_progress_poll_never_steals_the_heal_report(tmp_path: Path, monkeypatch) -> None:"""validator validator 재현 결함의 회귀 가드: 장기 heal 완료 직후/api/progress(또는 다운로드) 역할의 maybe_heal 이 먼저 호출돼도 리포트는diff --git a/tests/frames/test_pitch_ground_truth.py b/tests/frames/test_pitch_ground_truth.pyindex 6a5aced..21a4337 100644--- a/tests/frames/test_pitch_ground_truth.py+++ b/tests/frames/test_pitch_ground_truth.py@@ -100,6 +100,7 @@ def test_fractional_pitch_roundtrips_to_the_original_logical_art(scale):assert _mismatch(snapped, art) <= art.width * art.height // 100def test_integer_pitch_still_snaps_exactly():art = _logical_art()for scale in (12, 16, 20):diff --git a/tests/frames/test_pitch_runlen_crosscheck.py b/tests/frames/test_pitch_runlen_crosscheck.pyindex 4213a60..f64269b 100644--- a/tests/frames/test_pitch_runlen_crosscheck.py+++ b/tests/frames/test_pitch_runlen_crosscheck.py@@ -14,6 +14,7 @@ detect_pixel_grid 는 정수 씨앗 ±0.75 창 안에서만 소수 피치를 정import jsonimport random+import pytestfrom PIL import Imageimport sprite_gen.frames.extract as extract_module@@ -156,6 +157,7 @@ def _build_pixel_perfect_run(root):return run_dirdef test_pipeline_reports_crosscheck_warning_without_touching_snap(tmp_path, monkeypatch, capsys):"""통합 계약 두 가지를 한 픽스처로 고정한다.diff --git a/tests/frames/test_takes_heal.py b/tests/frames/test_takes_heal.pyindex 21185fb..7f9fde7 100644--- a/tests/frames/test_takes_heal.py+++ b/tests/frames/test_takes_heal.py@@ -66,6 +66,7 @@ def _manifest(run_dir: Path) -> dict:return json.loads((run_dir / "frames" / "frames-manifest.json").read_text(encoding="utf-8"))def test_takes_extend_row_pool(tmp_path: Path) -> None:takes = [{"label": "alt", "frames": 2}]run_dir = _build_run(tmp_path, takes=takes)@@ -126,6 +127,7 @@ def test_heal_keeps_stale_row_without_raw(tmp_path: Path) -> None:assert (run_dir / "frames" / "walk" / "frame-0.png").read_bytes() == frame_bytesdef test_view_heals_and_downloads_live_state(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:"""뷰/다운로드 계약: 스냅샷 요청이 stale 캐시를 자가치유하고, 버튼 3종은현재 라이브 상태를 계산해 zip 으로 내려준다 (게임 적용 의미 없음)."""@@ -211,6 +213,7 @@ def test_atlas_reuses_cells_for_identical_instances(tmp_path: Path) -> None:assert anim["durations_ms"] == [round(1000 / anim["fps"])] * 4def test_heal_isolates_failures_per_state(tmp_path: Path) -> None:"""상태별 격리 (2026-07-22): 한 행의 재추출 실패가 다른 행의 스왑을 막지도,failed 보고에 연좌시키지도 않는다 (회귀 synthetic_fixture_a — 6행 실패가 33행diff --git a/tests/frames/test_ui_kit.py b/tests/frames/test_ui_kit.pyindex e115d29..723da05 100644--- a/tests/frames/test_ui_kit.py+++ b/tests/frames/test_ui_kit.py@@ -79,6 +79,12 @@ PIP_OFF = (70, 60, 50, 255)KNOB = (180, 190, 210, 255)+def slow_but(values, fast):+ """``values`` for a parametrize: those ``fast`` takes stay in the fast bundle, the rest are marked slow and run by+ `pytest --full` — the same property read on more samples, or the same sweep at more places."""+ return [value if fast(value) else pytest.param(value, marks=pytest.mark.slow) for value in values]++def fill(pixels, x0, y0, x1, y1, color):pixels[y0:y1, x0:x1] = color@@ -389,6 +395,7 @@ REPORT_PLACES = []def test_a_report_anywhere_names_the_written_pngs_and_packs_the_same(tmp_path):image, _ = synthetic_sheet()sheet = tmp_path / "uikit.png"@@ -721,7 +728,8 @@ def test_a_sheet_squeezed_from_the_top_by_any_accepted_amount_names_the_missing_assert_cut_as_drawn(report, elements, drawn, (1, 0, squeeze, 0))[email protected]("subset", range(2 ** len(BAND)))+# fast: no element left out, and each left out alone[email protected]("subset", slow_but(range(2 ** len(BAND)), lambda subset: subset & (subset - 1) == 0))def test_every_set_of_missing_band_elements_under_a_random_accepted_drift_is_named_and_the_rest_cut_as_drawn(subset):# Each of the 256 sets of band elements left out, on a sheet drawn under a drift picked at random (seeded by the# set) within the accepted range: a scale and an offset along x and along y.@@ -791,6 +799,7 @@ def two_way_sheet(dot):return Image.fromarray(pixels), drawn@pytest.mark.parametrize("dot", [(18, 18), (60, 18)])def test_a_drawing_that_fits_the_layout_two_ways_is_refused_with_its_own_reason(tmp_path, dot):# Where the layout puts the boxes, and with the layout squeezed to 0.9, every frame lies inside its own box, clear@@ -987,7 +996,7 @@ def test_a_sheet_of_small_drawings_that_fits_the_layout_one_way_is_cut_as_drawn(assert sorted(p.name for p in out.iterdir()) == sorted([f"{name}.png" for name in drawn] + ["ui-kit.json"])[email protected]("seed", range(512))[email protected]("seed", slow_but(range(512), lambda seed: seed < 16))def test_a_sheet_of_small_drawings_under_a_random_accepted_drift_is_cut_as_drawn_or_refused_as_two_readings(seed):# Small drawings anywhere inside their boxes leave the drift less certain, so a sheet may fit the layout under two# drifts that read it differently, and is then refused, naming both readings. It is never refused for another@@ -997,7 +1006,7 @@ def test_a_sheet_of_small_drawings_under_a_random_accepted_drift_is_cut_as_drawnassert_read_as_drawn(image, drawn)[email protected]("seed", range(256))[email protected]("seed", slow_but(range(256), lambda seed: seed < 8))def test_full_size_frames_and_small_band_drawings_are_cut_as_drawn_or_refused_as_two_readings(seed):# The full-size frames pin the drift; the band's small drawings lie anywhere inside their boxes, off their centres.image, drawn = anchored_sheet(seed)@@ -1034,7 +1043,7 @@ def counterexample_sheet(label):return synthetic_sheet(size=TALL, stray=True)[0], (1, 0, 1, 0)[email protected]("label", COUNTEREXAMPLE_SHEETS)[email protected]("label", slow_but(COUNTEREXAMPLE_SHEETS, lambda label: label in {"scattered-1", "anchored-0"}))def test_no_sampled_drift_reads_the_drawing_better_than_the_cut_found(label):# A search for counterexamples, which proves nothing when it finds none: thousands of drifts at random, uniform over# the drifts the cut considers and near the drift the sheet was drawn with and the cut's, evaluated here. None reads@@ -1083,6 +1092,7 @@ def test_a_mark_between_two_boxes_whose_widened_boxes_touch_is_never_read_in_no_assert None not in reading.boxes and cost[0] <= refused.value.least + TIE + 1e-6, (reading, cost[0])@pytest.mark.timeout(10)def test_a_sheet_of_many_small_parts_is_cut_or_refused_in_seconds():# Every element a 4 px square (16 px, the smallest part kept) anywhere inside its moved box, with about half the@@ -1260,8 +1270,8 @@ def files_of(state):@pytest.mark.parametrize("mode", ["raise", pytest.param("kill", marks=pytest.mark.skipif(not hasattr(os, "fork"), reason="a kill is a child process ended at the fault"))])@pytest.mark.parametrize("when", ["before", "after"])[email protected]("start", ["absent", "empty", "empty, removed first"])[email protected]("placement", sorted(PUBLISH_PLACES))[email protected]("start", slow_but(["absent", "empty", "empty, removed first"], lambda start: start == "absent"))[email protected]("placement", slow_but(sorted(PUBLISH_PLACES), lambda placement: placement == "inside"))def test_a_failure_or_a_kill_at_any_step_of_the_publish_leaves_nothing_or_the_whole_kit(tmp_path, monkeypatch, placement, start, when, mode):# Each filesystem call of the publish fails once, just before it runs or just after it returned, in a copy of the@@ -1361,8 +1371,8 @@ INTERRUPTS = {@pytest.mark.filterwarnings("ignore:unclosed file:ResourceWarning")@pytest.mark.parametrize("kind", sorted(INTERRUPTS))@pytest.mark.parametrize("granularity", ["line", "instruction"])[email protected]("start", ["absent", "empty", "empty, removed first"])[email protected]("placement", sorted(PUBLISH_PLACES))[email protected]("start", slow_but(["absent", "empty", "empty, removed first"], lambda start: start == "absent"))[email protected]("placement", slow_but(sorted(PUBLISH_PLACES), lambda placement: placement == "inside"))def test_an_interrupt_at_any_line_or_instruction_of_the_publish_leaves_nothing_or_the_whole_kit(tmp_path, monkeypatch, placement, start, granularity, kind):# Python may raise an interrupt at any instruction: a signal's handler runs between instructions, and so does adiff --git a/tests/gen/test_prompt_freeze.py b/tests/gen/test_prompt_freeze.pyindex cc659e7..10c5ded 100644--- a/tests/gen/test_prompt_freeze.py+++ b/tests/gen/test_prompt_freeze.py@@ -95,6 +95,7 @@ def _first_difference(name: str, was: str, now: str) -> str:return f"{name}:\n" + "\n".join(diff)def test_the_table_is_the_one_the_fixture_was_drawn_from(frozen, drawn) -> None:assert sorted(drawn) == sorted(frozen)assert {name.split("/")[0] for name in frozen} == set(GROUPS)diff --git a/tests/release/test_fast_bundle.py b/tests/release/test_fast_bundle.pynew file mode 100644index 0000000..a2fd86b--- /dev/null+++ b/tests/release/test_fast_bundle.py@@ -0,0 +1,69 @@+# SPDX-License-Identifier: Apache-2.0+"""A plain `pytest` is the fast bundle: tests/conftest.py deselects the tests marked `slow`, and `pytest --full` runs+every test. The release lane measures a commit on every test, so each pytest call of `scripts/linux_lane.sh` carries+`--full` (docs/release.md)."""++from __future__ import annotations++import re+import subprocess+import sys+from pathlib import Path++ROOT = Path(__file__).resolve().parents[2]++PROBE = '''+import pytest+++def test_marked_slow():+ pass++[email protected]("case", [1, 2])+def test_every_case_marked_slow(case):+ pass++[email protected]("case", [1, pytest.param(2, marks=pytest.mark.slow)])+def test_one_case_marked_slow(case):+ pass+++def test_unmarked():+ pass+'''+++def _collected(tmp_path: Path, *args: str) -> tuple[list[str], str]:+ # This repository's configuration, and tests/conftest.py as the one conftest (-p), over a file outside the suite.+ proc = subprocess.run(+ [sys.executable, "-m", "pytest", "--collect-only", "-c", str(ROOT / "pyproject.toml"), "--rootdir", str(tmp_path),+ "--noconftest", "-p", "conftest", "-p", "no:cacheprovider", *args, str(tmp_path / "test_probe.py")],+ cwd=ROOT,+ capture_output=True,+ encoding="utf-8",+ )+ assert proc.returncode == 0, f"{proc.stdout[-3000:]}\n{proc.stderr[-3000:]}"+ return re.findall(r"<Function (\S+)>", proc.stdout), proc.stdout+++def test_a_plain_run_deselects_the_tests_marked_slow_and_full_runs_every_test(tmp_path):+ (tmp_path / "test_probe.py").write_text(PROBE)+ fast, said = _collected(tmp_path)+ assert fast == ["test_one_case_marked_slow[1]", "test_unmarked"], said+ assert "fast bundle: the tests marked slow are deselected; `pytest --full` runs every test" in said+ assert "(4 deselected)" in said+ every, said = _collected(tmp_path, "--full")+ assert every == ["test_marked_slow", "test_every_case_marked_slow[1]", "test_every_case_marked_slow[2]",+ "test_one_case_marked_slow[1]", "test_one_case_marked_slow[2]", "test_unmarked"], said+ assert "fast bundle" not in said and "deselected" not in said+++def test_every_pytest_call_of_the_lane_runs_every_test():+ lane = (ROOT / "scripts" / "linux_lane.sh").read_text(encoding="utf-8")+ calls = [line for line in lane.splitlines() if "-m pytest" in line and not line.lstrip().startswith("#")]+ assert calls, "the lane runs no pytest"+ assert all(re.search(r"\s--full(\s|$)", line) for line in calls), callsdiff --git a/tests/release/test_lane_rife_collection.py b/tests/release/test_lane_rife_collection.pyindex be1b99f..927b617 100644--- a/tests/release/test_lane_rife_collection.py+++ b/tests/release/test_lane_rife_collection.py@@ -21,6 +21,8 @@ import sysfrom pathlib import Pathfrom xml.etree import ElementTree+import pytest+from sprite_gen.video import rifeROOT = Path(__file__).resolve().parents[2]@@ -78,7 +80,7 @@ def _rife_less_env(tmp_path: Path) -> dict[str, str]:def _collect(tmp_path: Path, name: str, env: dict[str, str]) -> dict[str, list[bool]]:out = tmp_path / f"{name}.json"proc = subprocess.run(- [sys.executable, "-m", "pytest", "--collect-only", "-qq", "-p", "rife_probe", "-p", "no:cacheprovider"],+ [sys.executable, "-m", "pytest", "--collect-only", "--full", "-qq", "-p", "rife_probe", "-p", "no:cacheprovider"],cwd=ROOT,env={**env, "RIFE_PROBE_OUT": str(out)},capture_output=True,@@ -88,9 +90,10 @@ def _collect(tmp_path: Path, name: str, env: dict[str, str]) -> dict[str, list[breturn json.loads(out.read_text())def test_every_test_rife_decides_is_marked_real_rife(tmp_path):(tmp_path / "rife_probe.py").write_text(PROBE)- # The whole suite, as the lane collects it: no PYTEST_ADDOPTS selecting a part.+ # The whole suite, as the lane collects it: `--full`, and no PYTEST_ADDOPTS selecting a part.base = _rife_less_env(tmp_path)base["PYTHONPATH"] = os.pathsep.join(filter(None, [str(tmp_path), base.get("PYTHONPATH")]))stand_in = _stand_in(tmp_path / "with")@@ -170,6 +173,7 @@ def test_in_a_skipped_file():'''def test_the_rife_less_run_fails_each_unmarked_skip_by_name(tmp_path):probes = {"test_guards.py": GUARDS, "test_guarded_file.py": GUARDED_FILE}for name, text in probes.items():diff --git a/tests/scene/test_layer_resample.py b/tests/scene/test_layer_resample.pyindex ac34ea6..df088a4 100644--- a/tests/scene/test_layer_resample.py+++ b/tests/scene/test_layer_resample.py@@ -20,6 +20,7 @@ from sprite_gen.scene.render import Rendererfrom sprite_gen.util.resample import resize_cell@pytest.mark.parametrize("scale", (2.0,))def test_a_scaled_layer_carries_no_colour_its_frame_did_not_have(tmp_path: Path, scale: float) -> None:src = figure()diff --git a/tests/serve/test_recolor_curation_view.py b/tests/serve/test_recolor_curation_view.pyindex 95df71c..e9c38ec 100644--- a/tests/serve/test_recolor_curation_view.py+++ b/tests/serve/test_recolor_curation_view.py@@ -188,6 +188,7 @@ def test_a_missing_sheet_is_reported_not_dropped(baked_run: Path) -> None:assert missing["present"] is False and missing["url"] is Nonedef test_the_pick_round_trips_through_the_view_save_route(baked_run: Path) -> None:assert _post_curation(baked_run, {"recolor": {"picked": "moss"}}) == 200assert recolor_pick(load_curation(baked_run)) == "moss"@@ -198,6 +199,7 @@ def test_the_pick_round_trips_through_the_view_save_route(baked_run: Path) -> Noassert recolor_pick(load_curation(baked_run)) is Nonedef test_a_save_that_does_not_author_the_pick_carries_it_over(baked_run: Path) -> None:"""A view on a run with no variant section omits the field — that must read as"untouched", not as "cleared" (same carry-over contract as `anchors`)."""diff --git a/tests/spec/test_publish_rwlock_cross_process.py b/tests/spec/test_publish_rwlock_cross_process.pyindex 6e2d69e..2edf2d8 100644--- a/tests/spec/test_publish_rwlock_cross_process.py+++ b/tests/spec/test_publish_rwlock_cross_process.py@@ -95,6 +95,7 @@ def test_reader_process_blocks_until_publish_releases(run_dir: Path) -> None:child.finish()def test_two_process_readers_hold_shared_lock_concurrently(run_dir: Path) -> None:hold = 2.0child = ChildGuard(run_dir, "read", hold)diff --git a/tests/video/test_auto_motion.py b/tests/video/test_auto_motion.pyindex 89d6943..43531fa 100644--- a/tests/video/test_auto_motion.py+++ b/tests/video/test_auto_motion.py@@ -155,6 +155,7 @@ def test_region_discovery_refuses_blank_input():auto_motion.discover([Image.new('RGBA', (100, 100)) for _ in range(6)], reference_index=0)def test_actual_cli_auto_selects_corrects_and_verifies_animation(tmp_path):source = [walker(k) for k in range(73)]keyed = tmp_path/'keyed'diff --git a/tests/video/test_auto_motion_uncorrected.py b/tests/video/test_auto_motion_uncorrected.pyindex 20296f4..b367abb 100644--- a/tests/video/test_auto_motion_uncorrected.py+++ b/tests/video/test_auto_motion_uncorrected.py@@ -30,6 +30,7 @@ def write_source(path, **kwargs):return pathdef test_real_boundary_match_emits_verified_unchanged_cycle_and_exposes_it(tmp_path, capsys):keyed = write_source(tmp_path / "keyed")out = tmp_path / "out"@@ -57,6 +58,7 @@ def test_real_boundary_match_emits_verified_unchanged_cycle_and_exposes_it(tmp_ploop.main(fixed)def test_uncertain_match_does_not_accept_bad_uncorrected_seam(tmp_path, monkeypatch):keyed = write_source(tmp_path / "keyed", bounce=3, drift=2)def uncertain(*args, **kwargs):diff --git a/tests/video/test_between_cache.py b/tests/video/test_between_cache.pyindex 3363f62..b7cd6a0 100644--- a/tests/video/test_between_cache.py+++ b/tests/video/test_between_cache.py@@ -79,6 +79,7 @@ def _pass(root: Path, names: list[str], made: Blend, **kw) -> dict:return align.align_set([root / n for n in names], interpolate=made, views=VIEWS, feet=feet or None, **kw)@pytest.mark.parametrize("between", ["rife", "auto"])def test_the_foot_pass_takes_every_frame_the_first_pass_made_and_delivers_the_same_bytes(tmp_path, between):"""The app's two passes: the set aligned, then aligned again on a copy with the feet told. The@@ -104,6 +105,7 @@ def test_the_foot_pass_takes_every_frame_the_first_pass_made_and_delivers_the_saassert _said(taken, tmp_path / "loops.foot", tmp_path / "loops.plain") == _said(plain, tmp_path / "loops.plain", tmp_path / "loops.plain")def test_a_frame_whose_inputs_changed_is_made_again_and_never_taken(tmp_path):"""A source frame changed by one pixel: every frame made from it is made again, every other istaken, and the loops come out as a pass with no directory makes them. Another length is other@@ -243,6 +245,7 @@ def _dot(cx: int, colour: tuple[int, int, int]) -> Image.Image:return Image.fromarray(im, "RGBA")@pytest.mark.skipif(sys.platform == "win32", reason="a shebang script cannot stand in for rife-ncnn-vulkan.exe")def test_the_same_rife_makes_its_frame_again_once_a_file_it_runs_from_changed(tmp_path):"""One Rife makes and keeps a frame, then its model's bytes are written over: the next pass makes the frame@@ -355,6 +358,7 @@ def _png(image: Image.Image) -> bytes:return out.getvalue()def test_nothing_is_kept_without_a_directory_and_a_stand_in_that_names_nothing_is_refused(tmp_path):root, names = _set(tmp_path)before = sorted(p.name for p in tmp_path.iterdir())@@ -370,6 +374,7 @@ def test_nothing_is_kept_without_a_directory_and_a_stand_in_that_names_nothing_iassert _hashes(root) == files and not (tmp_path / "kept").exists()def test_video_cycle_align_between_cache_reports_hits_and_misses(tmp_path, monkeypatch, capsys):"""The command line: `--between-cache` names the directory; the summary and the report carry thehits and misses. RIFE is the stand-in, found as `rife.Rife` is."""@@ -390,6 +395,7 @@ def test_video_cycle_align_between_cache_reports_hits_and_misses(tmp_path, monkeassert made > 0 and said["hits"] == (made if k else 0)@pytest.mark.real_rifedef test_real_rife_a_kept_frame_is_the_frame_made_again(tmp_path):"""The real binary makes the same bytes for the same frames, so a frame taken from thediff --git a/tests/video/test_body_anchor.py b/tests/video/test_body_anchor.pyindex fabce1b..b50c61f 100644--- a/tests/video/test_body_anchor.py+++ b/tests/video/test_body_anchor.py@@ -58,6 +58,7 @@ def test_zero_offset_leaves_frames_untouched():assert loop.ramp_frames(frames, 0) is framesdef test_run_loop_defaults_to_body_for_gaits_and_none_otherwise(tmp_path: Path):keyed = tmp_path / "keyed"keyed.mkdir()diff --git a/tests/video/test_body_anchor_gate.py b/tests/video/test_body_anchor_gate.pyindex 8bdcdd1..926ea27 100644--- a/tests/video/test_body_anchor_gate.py+++ b/tests/video/test_body_anchor_gate.py@@ -91,6 +91,7 @@ def _refused(root: Path, keyed: Path, name: str, **kw) -> tuple[str, dict]:return str(exc.value), json.loads((root / f"{name}.json").read_text())@pytest.mark.parametrize("start", [0, 3, 6, 12])def test_a_walk_that_slides_sideways_passes_on_the_cells_the_ramp_plays(tmp_path: Path, start: int):"""A cut of one stride, from wherever it starts: the source frames read its wrap about three times an ordinary@@ -109,6 +110,7 @@ def test_a_walk_that_slides_sideways_passes_on_the_cells_the_ramp_plays(tmp_pathassert refused["seam_measurement"] == "source-frames" and "seam_after_anchor" not in refuseddef test_the_walk_passes_as_cut_again_by_hand_with_the_repair_on_and_as_found(tmp_path: Path, monkeypatch):"""The walk cut again by hand with the repair as it runs by default, and the stride the search finds: the repairmakes no frame (none is off the flow), so the gate's reading of the cells that play is what passes them."""@@ -148,6 +150,7 @@ REFUSED = {}@pytest.mark.parametrize("case", list(REFUSED))def test_a_wrap_the_ramp_does_not_close_is_refused_as_the_source_frames_refuse_it(tmp_path: Path, case: str):at, spoil, kw = REFUSED[case]@@ -160,6 +163,7 @@ def test_a_wrap_the_ramp_does_not_close_is_refused_as_the_source_frames_refuse_iassert message == _refused(tmp_path, keyed, "none", anchor="none", **kw)[0]def test_a_cut_the_source_frames_pass_is_not_read_again(tmp_path: Path):"""The walk with no slide (the anchor moves nothing), the sliding walk under a limit its source frames pass, and awalk whose first frame moved 3 px, which the source frames pass: the gate's reading is the source frames', the@@ -180,6 +184,7 @@ def test_a_cut_the_source_frames_pass_is_not_read_again(tmp_path: Path):assert reports[sliding]["resampled_seam_ratio"] > loop_mod.SEAM_RATIO_MAXdef test_a_pinned_walk_is_gated_by_its_pin_and_read_on_its_source_frames(tmp_path: Path):"""A clip pinned to end on its first frame: the cut is every frame but the last, and the gate is the pin. Thesliding walk's wrap reads over the seam limit on the source frames and the ramp moves its cells, but nothing isdiff --git a/tests/video/test_clip_prompt.py b/tests/video/test_clip_prompt.pyindex bb1a1e2..0bffb0a 100644--- a/tests/video/test_clip_prompt.py+++ b/tests/video/test_clip_prompt.py@@ -126,6 +126,7 @@ def test_a_front_walk_carries_its_mid_step_redraw() -> None:assert "start_still" not in clip_prompt.plan_prompt(direction="side", state="walk", last_frame=False)def test_the_cli_prints_the_prompt_alone_or_the_record() -> None:args = [sys.executable, "-m", "sprite_gen.cli", "video-prompt", "--direction", "side", "--state", "walk", "--no-last-frame"]plain = subprocess.run(args, capture_output=True, encoding="utf-8")diff --git a/tests/video/test_crossfade.py b/tests/video/test_crossfade.pyindex 00680e9..9f1fa08 100644--- a/tests/video/test_crossfade.py+++ b/tests/video/test_crossfade.py@@ -125,6 +125,7 @@ def test_a_clean_drawing_between_far_drawings_outlined_in_grey_reads_over_the_liassert faults({**rife.smear(drawn, a, b), "ghost": rife.ghost(drawn)}) == []def test_auto_keeps_a_crossfaded_frame_and_names_it_to_look_at():sa, sb = (10, -10), (5, -5)a, b, _, there = _inside(sa, sb, 0.5)@@ -154,6 +155,7 @@ def _keyed(tmp_path: Path, name: str, length: int) -> Path:return keyeddef test_alignment_warns_on_a_crossfaded_frame_it_keeps(tmp_path, capsys):"""Resampled 8 to 12 through a RIFE whose colour run blends and whose coverage run is the union:the frames it makes across the legs' long steps are kept, each named in a warning line."""@@ -179,6 +181,7 @@ def test_jump_repair_takes_a_crossfaded_proposal_and_names_it(monkeypatch):assert first["made"][0]["proposal"]["crossfade"] > CROSSFADE_LOOK and out[1] is made@pytest.mark.real_rife@pytest.mark.timeout(900) # 12 calls of the binary at 384 x 576, each run 16 ways (-x -z): seconds on a GPU, minutes on a CPU's Vulkan driverdef test_real_rife_through_a_short_step_reads_no_crossfade():@@ -199,6 +202,7 @@ def _keyed_cape(tmp_path: Path, name: str, length: int) -> Path:return keyeddef test_a_loop_the_ghost_screen_does_not_read_is_named_on_stderr_not_only_in_the_report(tmp_path, capsys):"""A cut drawn part-covered in every frame is not judged by the screen (`reads` false) — and saysso on stderr in video-loop, and in the alignment's warnings, which video-cycle-align prints."""diff --git a/tests/video/test_cycle_align.py b/tests/video/test_cycle_align.pyindex 1b6506e..a37fb04 100644--- a/tests/video/test_cycle_align.py+++ b/tests/video/test_cycle_align.py@@ -221,6 +221,7 @@ def _cut(tmp_path: Path, name: str, length: int) -> Path:return outdef test_a_set_is_aligned_to_its_median_length_and_a_second_run_reads_the_source(tmp_path):dirs = [_cut(tmp_path, n, L) for n, L in (("S", 20), ("E", 24), ("N", 28))]rec = Recorder()@@ -247,6 +248,7 @@ def test_a_set_is_aligned_to_its_median_length_and_a_second_run_reads_the_sourceassert json.loads((tmp_path / "align.json").read_text())["kind"] == "sprite-gen-video-cycle-align-report"def test_each_loop_records_its_view_and_start_foot_and_a_view_per_loop_is_required(tmp_path):dirs = [_cut(tmp_path, n, L) for n, L in (("S", 20), ("E", 24))]with pytest.raises(SystemExit, match="1 --view for 2 --loop-dir"):@@ -296,6 +298,7 @@ def test_a_loop_whose_strip_as_cut_is_missing_is_refused_by_name_and_the_set_lefassert not (tmp_path / "align.json").exists()def test_a_loop_aligned_before_is_aligned_again_without_its_strip(tmp_path):"""Only a first alignment reads the strip as cut; a later one keeps the origin the first recorded."""dirs = [_cut(tmp_path, n, L) for n, L in (("S", 20), ("E", 24))]@@ -307,6 +310,7 @@ def test_a_loop_aligned_before_is_aligned_again_without_its_strip(tmp_path):assert meta["cycle_align"]["origin"] == origin and (dirs[0] / "walk.strip.png").is_file()def test_video_set_aligns_each_gait_filmed_in_two_or_more_directions(tmp_path):from sprite_gen.video import batch@@ -347,6 +351,7 @@ def test_video_cycle_align_without_rife_fails_and_leaves_the_set_as_cut(tmp_pathassert [(d / "walk.strip.png").read_bytes() for d in dirs] == beforedef test_video_cycle_align_between_nearest_needs_no_rife(tmp_path, monkeypatch):dirs = [_cut(tmp_path, n, L) for n, L in (("S", 20), ("E", 24), ("N", 28))]_no_rife(monkeypatch, tmp_path)@@ -357,6 +362,7 @@ def test_video_cycle_align_between_nearest_needs_no_rife(tmp_path, monkeypatch):assert all(json.loads((d / "walk.strip.json").read_text())["frames"] == 24 for d in dirs)def test_a_made_frame_darker_than_both_neighbours_is_named_in_the_warnings(tmp_path):def smudge(a: Image.Image, b: Image.Image, t: float) -> Image.Image:made = np.asarray(Image.blend(a, b, t)).copy()@@ -381,6 +387,7 @@ def _melt(a: Image.Image, b: Image.Image, t: float) -> Image.Image:return Image.fromarray(made, "RGBA")def test_a_made_frame_that_lost_its_outline_is_replaced_by_the_nearer_source_frame_and_named(tmp_path):"""--between auto (the default): every made frame is measured, and one that lost its outlinetakes the nearer source frame instead, named in the warnings and in its row (`method`@@ -425,6 +432,7 @@ def test_video_set_without_rife_skips_the_alignment_with_a_warning(tmp_path, monassert "video-set: warning: walk: cycles not aligned" in err and "sprite-gen rife install" in errdef test_cutting_a_loop_again_drops_the_kept_source(tmp_path):"""Once RIFE is installed a loop is cut again; the next alignment must read that cut."""dirs = [_cut(tmp_path, n, L) for n, L in (("S", 20), ("E", 24))]diff --git a/tests/video/test_cycle_align_foot.py b/tests/video/test_cycle_align_foot.pyindex 6af6b30..aa9f4e5 100644--- a/tests/video/test_cycle_align_foot.py+++ b/tests/video/test_cycle_align_foot.py@@ -72,6 +72,7 @@ def test_a_loop_whose_foot_is_not_named_is_listed_with_its_two_strike_frames(tmpassert json.loads((dirs[2] / "walk.strip.json").read_text())["cycle_align"]["start_foot_source"] is Nonedef test_the_foot_given_for_one_loop_turns_that_loop_alone_half_a_cycle(tmp_path):"""Its left foot lands on the first strike: the loop starts half a cycle on, where its rightlands. The other two loops come out byte for byte as they were. (A loop named by its directorydiff --git a/tests/video/test_cycle_align_foot_margin.py b/tests/video/test_cycle_align_foot_margin.pyindex 9f40e8e..454796a 100644--- a/tests/video/test_cycle_align_foot_margin.py+++ b/tests/video/test_cycle_align_foot_margin.py@@ -9,6 +9,8 @@ the margin), 4 levels by 0.0314 (over it), the default 60 by far more."""from __future__ import annotations+import pytest+from sprite_gen.video import alignfrom tests.video.test_cycle_align import _cycle@@ -33,6 +35,7 @@ def test_a_shade_that_clears_the_margin_names_the_foot_as_before():assert clear["feet"] == shaded["feet"] == ["right", "left"]def test_a_low_margin_loop_is_listed_for_whoever_looks_and_the_others_stay_named(tmp_path):dirs = [_cut(tmp_path, "S", view="front"), _cut(tmp_path, "E", view="side"),_cut(tmp_path, "L", view="side", far_darker=FAINT), _cut(tmp_path, "C", view="side", far_darker=CLEAR)]diff --git a/tests/video/test_cycle_suspects.py b/tests/video/test_cycle_suspects.pyindex 91194fb..6e9ebad 100644--- a/tests/video/test_cycle_suspects.py+++ b/tests/video/test_cycle_suspects.py@@ -292,6 +292,7 @@ def _set(tmp_path: Path) -> list[Path]:return [_cut(tmp_path, "S", 24, 24), _cut(tmp_path, "E", 24, 24), _cut(tmp_path, "NE", 15, 30, twos=True)]def test_a_set_with_a_suspect_is_stopped_before_anything_is_rewritten(tmp_path):dirs = _set(tmp_path)before = [(d / "walk.strip.png").read_bytes() for d in dirs]@@ -313,6 +314,7 @@ def test_a_set_with_a_suspect_is_stopped_before_anything_is_rewritten(tmp_path):assert stopped.value.suspects == report["suspects"]def test_cycles_two_takes_one_cycle_out_of_the_loop_as_filmed(tmp_path):"""`--cycles NE=2`: 15 frames out of NE's 30 — from where the frame 15 on is most like the first— and the set aligned to its median, 24. Run again, it reads the same 30 filmed frames."""@@ -329,6 +331,7 @@ def test_cycles_two_takes_one_cycle_out_of_the_loop_as_filmed(tmp_path):assert {Path(r["dir"]).name: r["cycle_taken"]["start"] for r in again["loops"] if "cycle_taken" in r} == {"NE": taken["start"]}def test_multi_cycle_warn_aligns_the_set_as_it_is_and_names_the_loop(tmp_path):dirs = _set(tmp_path)report = align.align_set(dirs, interpolate=_Blend(), multi_cycle="warn")@@ -337,6 +340,7 @@ def test_multi_cycle_warn_aligns_the_set_as_it_is_and_names_the_loop(tmp_path):assert report["suspects"][0]["status"] == "warned"def test_the_number_of_cycles_in_a_loop_changes_only_with_cycles(tmp_path, monkeypatch):"""Every way of aligning a set but `--cycles k>1` resamples each loop from all of its filmedframes: take_cycle is never reached."""@@ -356,6 +360,7 @@ def test_the_number_of_cycles_in_a_loop_changes_only_with_cycles(tmp_path, monkealign.align_set(dirs, interpolate=_Blend(), cycles={"NE": 2})@pytest.mark.parametrize("strides, odd, state, kw", [((18, 18, 20), 0, "run", dict(far=170)), # rejected round 1's set: one loop's far leg shaded like the near one])@@ -374,6 +379,7 @@ def test_the_counter_example_sets_stop_and_align_as_before_once_counted(tmp_pathassert all(e["status"] == "counted" for e in report["suspects"]) and not any("may hold" in w for w in report["warnings"])def test_cycles_names_one_loop_or_is_refused(tmp_path):dirs = [_cut(tmp_path / "a", "loop", 24, 24), _cut(tmp_path / "b", "loop", 20, 20)]with pytest.raises(SystemExit, match="names 2 of the --loop-dir"):@@ -389,6 +395,7 @@ def test_cycles_names_one_loop_or_is_refused(tmp_path):align.parse_cycles(["NE"])def test_the_command_takes_cycles(tmp_path, monkeypatch, capsys):dirs = _set(tmp_path)monkeypatch.setattr(align.rife_mod, "Rife", _Blend)@@ -402,6 +409,7 @@ def test_the_command_takes_cycles(tmp_path, monkeypatch, capsys):# --- video-set ----------------------------------------------------------------------------def test_video_set_skips_a_suspect_state_with_a_warning(tmp_path, capsys):rows = []for direction, stride, length, twos in (("front", 24, 24, False), ("side", 24, 24, False), ("back", 15, 30, True)):diff --git a/tests/video/test_edge_speck_lead_in.py b/tests/video/test_edge_speck_lead_in.pyindex e685a69..c6ec2c1 100644--- a/tests/video/test_edge_speck_lead_in.py+++ b/tests/video/test_edge_speck_lead_in.py@@ -94,6 +94,7 @@ def test_the_loop_cut_reads_its_loose_pieces_as_before():assert kept == 0 and keyed is imagedef test_a_motion_auto_loop_of_a_clip_with_a_fleck_is_cut_without_it(tmp_path):# The fleck drifts across the background far from the walker, never into the edge band: keyed and cut# with `--anchor motion-auto`, which never cleans a frame, the cells are only as wide as the walker.@@ -187,6 +188,7 @@ def zoomed(k: int, *, period: int = 24, frames: int = 9, start: float = 0.63) ->resample=Image.Resampling.BICUBIC).convert("RGBA")def test_a_lead_in_is_the_first_frames_off_the_walks_size():lead = gait_fallback.lead_in([zoomed(k) for k in range(73)], min_lag=12, max_lag=36)assert 4 <= lead["frames"] <= 7 and lead["first_off"] < -0.3 and 0.45 < lead["height_change"] < 0.65@@ -209,6 +211,7 @@ def test_a_lead_in_is_the_first_frames_off_the_walks_size():assert short["frames"] == 0 and "too short" in short["why"]def test_the_search_reads_the_walk_after_its_lead_in(tmp_path):# Searched as filmed, the reframing hides the walk's repeat and the gait fallback fails too.code, report, _ = walks.run(tmp_path, [zoomed(k) for k in range(73)], "--size-hold", "off")@@ -222,6 +225,7 @@ def test_the_search_reads_the_walk_after_its_lead_in(tmp_path):assert report["window"] == list(loop.profile_for("walk").window(73 - lead["frames"], 24.0))def test_a_refusal_after_a_lead_in_names_windows_in_the_clips_frames(tmp_path):# Too slow a walk to repeat: refused, with the windows measured — every one after the lead-in, numbered# as the clip is, which `--cycle fixed --start` cuts on.@@ -233,6 +237,7 @@ def test_a_refusal_after_a_lead_in_names_windows_in_the_clips_frames(tmp_path):assert lead >= 4 and min(starts) >= leaddef test_the_gait_fallback_scales_back_by_the_size_read_one_cycle_on(tmp_path):# A walker that settles from its standing first pose and grows 5 %: a line through every frame reads# under 3 % and the frames were searched as filmed; one cycle on, the growth is read and scaled back.@@ -264,6 +269,7 @@ def _fixed(tmp_path: Path, clip: list[Image.Image], start: int) -> tuple[dict, dreturn out, json.loads((tmp_path / "out" / "w.strip.json").read_text()), keyeddef test_a_cut_after_a_lead_in_reads_the_standing_height_on_its_own_first_frame(tmp_path):# Read on the first frame, filmed small, the standing height scaled the walk up by half again.out, meta, keyed = _fixed(tmp_path, [zoomed(k) for k in range(73)], 12)diff --git a/tests/video/test_explicit_window.py b/tests/video/test_explicit_window.pyindex 2bad218..b7498d4 100644--- a/tests/video/test_explicit_window.py+++ b/tests/video/test_explicit_window.py@@ -77,6 +77,7 @@ def _bound(args: tuple[str, ...], flag: str) -> int | None:return int(args[args.index(flag) + 1]) if flag in args else None@pytest.mark.parametrize("path, clip, args, ran, cut", ROWS, ids=[f"{r[0]}{''.join(r[2][-2:])}" for r in ROWS])def test_an_explicit_window_holds_on_every_path(tmp_path, path, clip, args, ran, cut):keyed = clip(tmp_path / "clip")diff --git a/tests/video/test_follow.py b/tests/video/test_follow.pyindex c05eac9..35c7cc9 100644--- a/tests/video/test_follow.py+++ b/tests/video/test_follow.py@@ -61,6 +61,7 @@ def chest_region(loop_dir):return ((xs.min()+xs.max())/2, (ys.min()+ys.max())/2, (xs.max()-xs.min())/2+4, (ys.max()-ys.min())/2+4)def test_the_region_moves_with_the_bob_and_nothing_else_does(loop_dir):before = json.loads((loop_dir/'walk.strip.json').read_text())old = cells(loop_dir/'walk.strip.png', before)@@ -163,6 +164,7 @@ def bunny(k, ears, period=24):return imdef test_ears_as_thick_as_the_body_do_not_move_it(tmp_path):# Ears this thick outlast the wearing, and a cell laid on cell 0 alone lies ears on ears: in the cells where# the ears had swung less than their own thickness from where cell 0 has them the body was read as dropping@@ -231,6 +233,7 @@ def test_an_alignment_clears_the_follow_through_and_says_so(loop_dir):assert not (loop_dir/follow.SOURCE).exists()def test_a_new_cut_removes_the_old_follow_source(loop_dir, tmp_path):follow.follow_loop(loop_dir, [chest_region(loop_dir)])code = loop.main(['--frames-dir', str(tmp_path/'keyed'), '--out-dir', str(loop_dir), '--state', 'walk', '--anchor', 'motion-auto',@@ -287,6 +290,7 @@ def folds_nowhere(rec, meta):return worst < 1, worstdef test_lower_takes_the_largest_gain_that_does_not_fold(loop_dir):region = small_region(loop_dir, 0.7) # folds at 0.7 of the default gain: 1.75with pytest.raises(SystemExit, match='folds a region'):@@ -324,6 +328,7 @@ def moved_alone(loop_dir, region, **kw):return strip, (strip != source).any(axis=-1), meta['follow']def test_each_region_takes_its_own_gain(loop_dir):small = head_region(loop_dir, 0.7) # folds at 1.75chest = chest_region(loop_dir) # does not fold at the default gain@@ -366,6 +371,7 @@ def test_overlapping_regions_of_different_gains_fold_nowhere(loop_dir):assert ok, worstdef test_a_region_too_small_to_move_is_held_and_the_rest_move(loop_dir):# One gain for the strip, set by its smallest region, refused the whole strip for a region under the# mass as measured: the chest did not move because of an ear.@@ -404,6 +410,7 @@ def test_a_strip_whose_every_region_is_held_is_refused(loop_dir):assert (loop_dir/'walk.strip.json').read_text() == metadef test_regions_that_take_one_gain_are_written_as_one_gain(loop_dir):# Two regions of the same smaller radius fold at the same gain: the record is the one-gain record,# with no gain of its own per region, and the strip is the one that gain asked for gives.@@ -480,6 +487,7 @@ def outputs(loop_dir):return {name: (loop_dir/name).read_bytes() for name in ('walk.strip.png', 'walk.gif', 'walk.webp', 'walk.strip.json')}def test_numpy_numbers_write_what_the_command_line_writes(loop_dir):# The command line gives floats. Numpy numbers from a caller wrote the strip, the GIF and the WebP and then# failed on the record (an int64 has no JSON form): a moved strip beside a record that does not say so.@@ -533,6 +541,7 @@ def test_bad_regions_are_refused(loop_dir):follow.parse_region('1,2,0,3')def test_a_region_over_the_soft_outline_leaves_no_colour_under_clear_pixels(tmp_path):# The part on the outline: its edge is partly transparent, and moving it must not leave colour# where the coverage rounds to nothing (the WebP check refuses that).diff --git a/tests/video/test_follow_inspect.py b/tests/video/test_follow_inspect.pyindex b9d2ba8..9de9db8 100644--- a/tests/video/test_follow_inspect.py+++ b/tests/video/test_follow_inspect.py@@ -235,6 +235,7 @@ def test_each_region_has_its_gain_and_one_held_is_still_carried(tmp_path):assert [int(c.sum()) for c in changed] == [cell['changed_px'] for cell in record['cells']]def test_regions_are_recorded_in_the_order_given_and_cells_in_the_strips(tmp_path):reach = unit(tmp_path)crown = (66.0, 20.0, folding_at(1.755, reach), folding_at(1.755, reach))@@ -259,6 +260,7 @@ def test_regions_are_recorded_in_the_order_given_and_cells_in_the_strips(tmp_patassert len({tuple(box) for box in boxes}) == N and boxes[0][0] < boxes[1][0] and boxes[0][1] == boxes[1][1] < boxes[one['boards']['columns']][1]def test_what_was_read_names_the_evidence_and_another_cut_is_another(tmp_path):loop_dir = strip_dir(tmp_path/'loop')first = inspect(loop_dir, [CHEST], tmp_path/'a')@@ -294,6 +296,7 @@ def test_what_was_read_names_the_evidence_and_another_cut_is_another(tmp_path):assert noted['cells'] == first['cells'] and slower['follow']['dy_px'] != first['follow']['dy_px']def test_what_the_answer_is_asked_with_is_in_the_id_and_how_the_boards_are_drawn_is_not(tmp_path):loop_dir = strip_dir(tmp_path/'loop')base = inspect(loop_dir, [CHEST], tmp_path/'base')diff --git a/tests/video/test_follow_stretch_floor.py b/tests/video/test_follow_stretch_floor.pyindex d2fc097..203ad5b 100644--- a/tests/video/test_follow_stretch_floor.py+++ b/tests/video/test_follow_stretch_floor.py@@ -73,6 +73,7 @@ def drawn(loop_dir):# ---------------------------------------------------------------- F1: the floor is kept in every cell@pytest.mark.parametrize('floor', FLOORS)def test_f1_every_cell_of_every_region_keeps_the_floor(probes, tmp_path, floor):for name, (_, region) in (('X1', X1), ('X2', X2)):@@ -123,6 +124,7 @@ def test_f2_where_the_floor_is_stricter_its_gain_stands(probes, tmp_path):# ---------------------------------------------------------------- F3: a floor the move already keeps changes no pixeldef test_f3_a_floor_under_the_least_area_already_kept_draws_the_same_strip(probes, tmp_path):_, region = X2legacy_dir, legacy = followed(probes['X2'], tmp_path/'legacy', [region])@@ -138,6 +140,7 @@ def test_f3_a_floor_under_the_least_area_already_kept_draws_the_same_strip(probe# ---------------------------------------------------------------- F4: the floor alone, by direction, is not shippeddef test_f4_a_floor_of_nothing_is_the_fold_rule_not_the_direction_alone(probes, tmp_path):# Read by direction alone, X2's region may move twice as far before its picture stops; that stretches a# pixel to a twentieth of its area where the fold rule leaves it half. The floor never goes past the rule.@@ -218,6 +221,7 @@ def test_q1_regions_apart_or_held_have_no_seam(probes, tmp_path):assert [r['held'] for r in held['regions']] == [False, True] and held['seams'] == []def test_the_inspection_names_the_floor_and_the_read_on_in_its_id(probes, tmp_path):_, region = X1ids = {follow_inspect.inspect_loop(probes['X1'], [region], tmp_path/f'out-{floor}', on_fold='lower', stretch_floor=floor)['input_id']diff --git a/tests/video/test_gait_fallback.py b/tests/video/test_gait_fallback.pyindex 777c83c..24ac3bc 100644--- a/tests/video/test_gait_fallback.py+++ b/tests/video/test_gait_fallback.py@@ -116,6 +116,7 @@ def test_a_body_that_keeps_its_place_and_size_reads_them_exactly():assert np.all(measured['height'] == y1-y0) and measured['drift'] == 0def test_the_size_hold_is_the_same_whatever_the_lapack_rounding(monkeypatch):"""Feet that stand on the frame's bottom edge in every frame: the hold scales about them, sonothing reaches past that edge and no room is added below. The foot point is read off a fitted@@ -139,6 +140,7 @@ def test_the_size_hold_is_the_same_whatever_the_lapack_rounding(monkeypatch):assert next(iter(seen))[0][3] == 0def test_a_clip_the_first_search_cuts_is_cut_without_the_fallback(tmp_path):code, report, output = run(tmp_path, [walker(k) for k in range(73)])assert code == 0@@ -151,6 +153,7 @@ def test_a_clip_the_first_search_cuts_is_cut_without_the_fallback(tmp_path):assert 'padding_ltrb' not in report['size_hold']def test_a_cycle_longer_than_half_the_clip_is_found_by_the_fallback(tmp_path):frames = [walker(k, period=40) for k in range(73)]code, report, output = run(tmp_path, frames)@@ -163,6 +166,7 @@ def test_a_cycle_longer_than_half_the_clip_is_found_by_the_fallback(tmp_path):assert not (output/loop.FALLBACK_FRAMES_DIR).exists()def test_a_walk_toward_the_camera_is_held_at_its_size_before_the_first_search(tmp_path):frames = [walker(k, grow=0.2) for k in range(73)]code, report, output = run(tmp_path, frames)@@ -178,6 +182,7 @@ def test_a_walk_toward_the_camera_is_held_at_its_size_before_the_first_search(tmassert not (output/loop.FALLBACK_FRAMES_DIR).exists()def test_a_small_change_of_size_is_held_too(tmp_path):# Under the fallback's 3 %, over the hold's 1 %: held, the walker loops at its size; searched as# filmed, the growing walker never matches itself and the fallback does not scale it back.@@ -209,6 +214,7 @@ def test_the_size_is_read_one_cycle_on():assert short['lag'] is None and short['drift'] == 0.0def test_a_first_pose_that_settles_into_the_walk_is_not_held(tmp_path):# Stood tall, then walking: a line through every frame reads a body that shrinks; one cycle on,# every pose is the size it was.@@ -226,6 +232,7 @@ def test_a_first_pose_that_settles_into_the_walk_is_not_held(tmp_path):assert (output/'loop.strip.png').read_bytes() == (output_off/'loop.strip.png').read_bytes()def test_a_settle_does_not_hide_a_walk_that_grows(tmp_path):# The settle pulls the fitted line down by as much as the walk grows: a line reads under 1 %.frames = [settling(k, grow=0.025) for k in range(73)]@@ -249,6 +256,7 @@ def walking_away(k, frames=73):return outdef test_scaling_back_up_keeps_a_crown_carried_past_the_top():# Scaled back up about feet that have risen, the late frames' crown lands above the frame.# Widened first, nothing is cut.@@ -279,6 +287,7 @@ def test_no_room_is_added_when_nothing_reaches_out():assert all(f.size == frames[0].size for f in undone)def test_the_held_loop_of_a_shrinking_walk_keeps_its_crown(tmp_path):frames = [walking_away(k) for k in range(73)]code, report, output = run(tmp_path, frames)@@ -291,6 +300,7 @@ def test_the_held_loop_of_a_shrinking_walk_keeps_its_crown(tmp_path):assert np.all(np.abs((boxes[:, 3]-boxes[:, 1])-(first[3]-first[1])) <= 6)def test_a_walk_toward_the_camera_is_scaled_back_before_the_second_search(tmp_path):frames = [walker(k, grow=0.2) for k in range(73)]code, report, output = run(tmp_path, frames, '--size-hold', 'off')@@ -308,6 +318,7 @@ def test_a_walk_toward_the_camera_is_scaled_back_before_the_second_search(tmp_paassert not (output/loop.FALLBACK_FRAMES_DIR).exists()def test_no_cycle_in_either_search_says_so_and_keeps_the_gate_line(tmp_path):frames = [walker(0) for _ in range(73)]code, report, output = run(tmp_path, frames)diff --git a/tests/video/test_ghost_given_way.py b/tests/video/test_ghost_given_way.pyindex 14e6065..93df013 100644--- a/tests/video/test_ghost_given_way.py+++ b/tests/video/test_ghost_given_way.py@@ -382,6 +382,7 @@ def _app_ghost_given_way(report: dict, out: Path) -> None:_delivered_clean(out)def test_the_applications_walk_gives_a_small_filmed_ghost_way(tmp_path):"""B1b with a stand-in RIFE that takes the frame after: the band, 13 times the limit, is no jump, so before it wasdelivered in the strip and the WebP of a walk cut with the application's flags."""@@ -389,6 +390,7 @@ def test_the_applications_walk_gives_a_small_filmed_ghost_way(tmp_path):_app_ghost_given_way(report, tmp_path / "E")@pytest.mark.real_rifedef test_real_rife_the_applications_walk_gives_a_small_filmed_ghost_way(tmp_path):"""B1b through the real RIFE, located as `video-loop` locates it."""@@ -400,6 +402,7 @@ def test_real_rife_the_applications_walk_gives_a_small_filmed_ghost_way(tmp_path# --- the source projection and the restoration ------------------------------------------------------def test_a_cell_given_way_is_a_repair_hint_and_the_restoration_does_not_bring_the_ghost_back(tmp_path, monkeypatch):"""The cut's source projection proves every other cell exactly and lists the cell given way among the jumprepair's (`repair_hints`); a restoration request on the loop reads its playback, the GIF and WebP holding thediff --git a/tests/video/test_ghost_retake.py b/tests/video/test_ghost_retake.pyindex 9c020b9..d015ee8 100644--- a/tests/video/test_ghost_retake.py+++ b/tests/video/test_ghost_retake.py@@ -122,10 +122,12 @@ def _check_made_time(report: dict) -> None:for w in report["warnings"])def test_a_ghost_kept_at_a_made_time_is_a_take_to_film_again_and_its_fault_line_says_so(tmp_path):_check_made_time(_made_time(tmp_path, tg._follow))@pytest.mark.real_rifedef test_real_rife_a_ghost_kept_at_a_made_time_is_a_take_to_film_again(tmp_path):"""A2 through the real RIFE: its frame between the two ghosts carries them, and the cell keeps the ghost.diff --git a/tests/video/test_ghost_screen.py b/tests/video/test_ghost_screen.pyindex 9f5e4a5..8e91829 100644--- a/tests/video/test_ghost_screen.py+++ b/tests/video/test_ghost_screen.py@@ -141,6 +141,7 @@ def _cut(keyed: Path, out: Path, length: int) -> dict:name="walk", report_path=None, cycle_mode="fixed", start=0, length=length, anchor="none", repair="off")def test_alignment_delivers_no_filmed_ghost_and_names_each_cell_it_passed_over(tmp_path):"""Set length 22: S (20) lands on its ghost at a whole time, E (24) makes a frame next to itsghost, which carries it, and the nearer frame is that ghost. Both take the frame after it."""@@ -177,6 +178,7 @@ def test_jump_repair_rejects_a_proposal_that_carries_a_ghost(monkeypatch):assert [f.tobytes() for f in out] == before@pytest.mark.real_rifedef test_real_rife_delivers_no_cell_carrying_a_filmed_ghost():"""A filmed ghost resampled 4 to 8 through the real RIFE: before the screen the ghost itself wasdiff --git a/tests/video/test_held_drawings.py b/tests/video/test_held_drawings.pyindex d9880a6..73ee712 100644--- a/tests/video/test_held_drawings.py+++ b/tests/video/test_held_drawings.py@@ -134,6 +134,7 @@ def _follows(a: Image.Image, b: Image.Image, t: float) -> Image.Image:return a.copy() # a frame the interpolator drew whole, outlined as its neighboursdef test_a_held_loop_stretched_past_what_an_interpolator_bridges_is_named_for_a_retake(tmp_path, capsys):"""A cycle of 16 frames on twos (8 drawings) stretched to 24: 8 drawings a second, three framesapart, and the frames between them melt — a take to film again. The set is still aligned."""@@ -166,6 +167,7 @@ def test_a_held_loop_whose_frames_between_are_all_made_is_not_named(tmp_path):assert not any("film this direction again" in w for w in report["warnings"])def test_between_nearest_and_rife_name_the_frames_not_made(tmp_path):"""nearest makes no frame, so every one between drawings is taken; rife keeps a melted frame, a fault."""nearest = align.align_set([_cut(tmp_path / "n", "NE", 16, 2), _cut(tmp_path / "n", "S", 24, 1)], length=24, between="nearest")@@ -186,6 +188,7 @@ def test_a_held_loop_squeezed_past_on_twos_is_not_named(tmp_path):assert len(row["nearest_at"]) > 0 and row["retake"] is Nonedef test_the_clips_hold_is_read_from_the_strip_and_the_cycle_is_the_fallback(tmp_path):"""`video-loop` writes the clip's hold into the strip metadata, and the alignment reads it there; aloop cut before that record is measured on its own cycle, read as a ring."""diff --git a/tests/video/test_loop_ease.py b/tests/video/test_loop_ease.pyindex b7d18f8..3452e60 100644--- a/tests/video/test_loop_ease.py+++ b/tests/video/test_loop_ease.py@@ -153,6 +153,7 @@ def _legs_off(frames: list[Image.Image], loop: list[Image.Image]) -> float:return max(float((np.abs(played[p] - filmed[p]) / np.median(filmed[p][filmed[p] > 0])).max()) for p in LEGS)def test_a_tail_that_rushes_on_at_the_wrap_is_spread_over_the_frames_either_side_and_refused_for_the_legs_beat():# 2.45.0 took this stretch. Its frames made spread the tail and keep the feet, the torso, the ground line and the rest# of the body within the stretch's own steps, and stop the legs where the tail is given its time: refused for the@@ -197,6 +198,7 @@ def test_a_tail_that_rushes_on_at_the_wrap_is_spread_over_the_frames_either_sideassert _legs_off(frames, out) <= BEAT@pytest.mark.parametrize("n, lag, hold", [(WRAP, LAG, 1), (SHORT, SHORT_LAG, 1), (14, 0.15, 1), (48, LAG, 2)])def test_whatever_spreads_a_rush_the_legs_keep_their_own_beat(n, lag, hold):# Every frame of the stretch is made whole, the legs with the tail: a time that gives the tail's rush more steps gives@@ -216,6 +218,7 @@ def test_whatever_spreads_a_rush_the_legs_keep_their_own_beat(n, lag, hold):assert off.max() <= BEAT, f"{name}, {part}: step {int(off.argmax())} is {off.max():.2f} of an ordinary step off"def test_a_rush_the_flow_reading_lets_pass_is_read_too_and_refused_for_the_legs_beat():# A tail 15 % of a cycle short over 16 frames reads under the flow's limit: no frame is taken out, and it still rushes.# 2.45.0 took its stretch; the frames made spread the rush and stop the legs where the tail is given its time.@@ -233,6 +236,7 @@ def test_a_rush_the_flow_reading_lets_pass_is_read_too_and_refused_for_the_legs_assert all(o is f for o, f in zip(out, frames)) and record["replaced"] == []def test_with_the_beat_bound_lifted_a_stretch_that_keeps_every_other_reading_is_played_as_made(monkeypatch):# The delivery itself. Lifted, the beat refuses nothing: the same stretch is taken, every frame of it shown as it was# made, every frame outside it the video's own, and no rush is left.@@ -247,6 +251,7 @@ def test_with_the_beat_bound_lifted_a_stretch_that_keeps_every_other_reading_is_assert record["replaced"] == round_["replaced"] and round_["replaced"]def test_a_stretch_whose_frames_made_hurry_the_rest_of_the_body_is_refused():# Over 36 frames, easing a tail a tenth of a cycle short gives the rush more time and the steps around it less; the# search reads the rest of the body on the line between the frames as filmed and finds times that keep it, and the@@ -264,6 +269,7 @@ def test_a_stretch_whose_frames_made_hurry_the_rest_of_the_body_is_refused():assert record["surge_after"] is not None and "replaced" not in round_def test_an_ordinary_walk_has_no_rush_and_nothing_is_made():for frames in (_loop(), _loop(hold=2), _walk(), _walk(hold=2)):assert repair.surges(frames) == []@@ -277,6 +283,7 @@ def test_a_frame_flung_against_the_way_is_not_a_rush():assert repair.surges(_loop(flung={12: 12})) == [] and repair.surges(_walk(flung={12: 12})) == []def test_on_twos_each_drawing_is_made_once_for_both_its_frames_and_the_stretch_refused_for_the_legs_beat():# 2.45.0 took this stretch; read on its drawings, the frames made stop the legs where the tail is given its time.n = 48 # 24 drawings on twos@@ -294,6 +301,7 @@ def test_on_twos_each_drawing_is_made_once_for_both_its_frames_and_the_stretch_rassert [f.tobytes() for f in out] == [f.tobytes() for f in flow_only]def test_a_made_frame_that_moves_the_body_further_than_the_stretch_did_refuses_the_ease():n = WRAPframes = _walk(n, lag=LAG)@@ -315,6 +323,7 @@ def test_a_made_frame_that_moves_the_body_further_than_the_stretch_did_refuses_tassert set(record["replaced"]) == set(record["rounds"][0]["frames"])def test_a_made_frame_at_fault_refuses_the_ease_and_the_loop_stays_as_the_flow_left_it():n = WRAPframes = _walk(n, lag=LAG)@@ -336,6 +345,7 @@ def test_a_made_frame_at_fault_refuses_the_ease_and_the_loop_stays_as_the_flow_lassert [f.tobytes() for f in out] == [f.tobytes() for f in flow_only]def test_without_an_interpolator_a_rush_is_named_and_nothing_is_made():frames = _walk(lag=0.1)out, record = repair.repair_jumps(frames, None)@@ -343,6 +353,7 @@ def test_without_an_interpolator_a_rush_is_named_and_nothing_is_made():assert all(o is f for o, f in zip(out, frames)) and record["replaced"] == []def test_it_reads_the_same_stretch_and_refuses_it_alike_whichever_way_the_body_faces():# 2.45.0 took the same stretch either way; either way the frames made stop the legs where the tail is given its time.frames = _walk(SHORT, lag=SHORT_LAG)@@ -413,6 +424,7 @@ def _cut(tmp_path, frames: list[Image.Image], **kw):start=0, length=len(frames), anchor="none", **kw)def test_video_loop_reads_the_rush_refuses_the_stretch_for_the_legs_beat_and_plays_the_frames_as_cut(tmp_path, capsys):# 2.45.0 played this stretch's frames made; their legs stop where the tail is given its time. The stretch is made and# recorded, and the cells are the frames as cut.@@ -434,6 +446,7 @@ def test_video_loop_reads_the_rush_refuses_the_stretch_for_the_legs_beat_and_plaassert written["why"] == "ease" and written["rejected_for"] == ["the body off its beat"]def test_a_rush_without_rife_is_cut_as_filmed_with_a_warning(tmp_path, monkeypatch, capsys):_no_rife(monkeypatch, tmp_path)frames = _walk(lag=0.1)@@ -445,12 +458,14 @@ def test_a_rush_without_rife_is_cut_as_filmed_with_a_warning(tmp_path, monkeypatassert len(warning) == 1 and "sprite-gen rife install" in warning[0] and "not eased" in warning[0]def test_repair_on_without_rife_refuses_a_rush(tmp_path, monkeypatch):_no_rife(monkeypatch, tmp_path)with pytest.raises(SystemExit, match=r"for a part that rushes.*sprite-gen rife install"):_cut(tmp_path, _walk(lag=0.1), repair="on")def test_a_stretch_never_takes_more_than_half_the_loop_and_is_refused_for_the_legs_beat(monkeypatch):# Fourteen frames: four drawings a side would remake eight, more than the seven video-loop-compare reads back as the# repair's; three a side remakes six. 2.45.0 took the six; their legs stop where the tail is given its time.diff --git a/tests/video/test_loop_flow.py b/tests/video/test_loop_flow.pyindex 2534b7c..feb4c9e 100644--- a/tests/video/test_loop_flow.py+++ b/tests/video/test_loop_flow.py@@ -228,6 +228,7 @@ def test_on_twos_a_flung_drawing_is_made_once_and_shown_for_both_its_frames():assert record["rounds"][0]["drawings"] == [[12, 13]] and record["hold"] == 2def test_a_group_with_a_frame_at_fault_keeps_every_frame_it_would_take_and_is_not_tried_again():frames = _loop(flung={12: 20, 13: 20})between = Between(frames)diff --git a/tests/video/test_loop_overlap.py b/tests/video/test_loop_overlap.pyindex 23e9a66..0148d24 100644--- a/tests/video/test_loop_overlap.py+++ b/tests/video/test_loop_overlap.py@@ -171,24 +171,22 @@ def _keyed(root: Path) -> Path:return keyed-def _cut(root: Path, keyed: Path, *, repair_mode: str = "auto", interpolate=None, overlap: str | None = None) -> dict:- """The walker cut as `video-loop --state walk --anchor motion-auto` cuts it (with `--overlap-wrap overlap` where one is- given); the report, whether it passed or not."""- asked = {} if overlap is None else {"overlap_wrap": overlap}+def _cut(root: Path, keyed: Path, *, repair_mode: str = "auto", interpolate=None) -> dict:+ """The walker cut as `video-loop --state walk --anchor motion-auto` cuts it; the report, whether it passed or not."""try:loop.run_loop(keyed, root / "out", fps=24.0, state="walk", min_len=None, max_len=None, n_out=None,seam_max=loop.SEAM_RATIO_MAX, name="loop", report_path=root / "loop.json", anchor="motion-auto",- repair=repair_mode, interpolate=interpolate, **asked)+ repair=repair_mode, interpolate=interpolate)except SystemExit:passreturn json.loads((root / "loop.json").read_text())[email protected]("overlap", [None, "on"])-def test_a_tail_on_its_own_beat_is_closed_at_the_wrap_with_the_clips_frames_a_cycle_apart(tmp_path, overlap):+def test_a_tail_on_its_own_beat_is_closed_at_the_wrap_with_the_clips_frames_a_cycle_apart(tmp_path):keyed = _keyed(tmp_path)between = Between()- report = _cut(tmp_path, keyed, interpolate=between, overlap=overlap)+ report = _cut(tmp_path, keyed, interpolate=between)c = report["cycle"]s, L = c["start"], c["length"]assert c["steps"] == {"count": 2, "by": "crossings"} and abs(L - CYCLE) <= 1@@ -249,6 +247,7 @@ def test_the_drift_bound_is_the_stretch_as_the_loop_plays_it_never_the_clips_fraassert tried["drift"]["body_mass"]["bound"] == pytest.approx(_mass_step(stretch), abs=1e-3)def test_a_torso_that_slides_is_refused_however_the_tail_swings():"""(b) The second walker whose frames a cycle on stand SLID px aside as well as carrying the tuft over: the clip walkedon over the cycle, and a frame made near those frames slides the torso. Read on the torso, no run moves the walker@@ -284,40 +283,13 @@ def test_a_tail_carried_over_alone_is_taken_the_torso_within_its_pixel():"moved": _mass_step([new[q] for q in stretch])}, abs=1e-3)-class Reads(Between):- """The stand-in, counting the frames the overlapped wrap asks it to read apart from those it is only asked to make."""-- def __init__(self):- super().__init__()- self.reads = 0-- def read(self, a: Image.Image, b: Image.Image, t: float) -> tuple[Image.Image, np.ndarray]:- self.reads += 1- return super().read(a, b, t)---def test_with_the_overlapped_wrap_off_nothing_is_read_for_the_wrap_and_the_gate_refuses_the_cut_as_filmed(tmp_path, capsys):- """`--overlap-wrap off` (a host whose RIFE runs on a CPU, where one frame of the wrap takes minutes): the wrap the gate- refuses is not made again. The interpolator reads no frame for it, the record says it was turned off, and the gate- refuses the cut as filmed — the loop fails on its seam, as it does where every run is refused."""- reads = Reads()- report = _cut(tmp_path, _keyed(tmp_path), interpolate=reads, overlap="off")- assert report["status"] == "failed" and report["error"].startswith("video-loop: loop seam ratio")- assert report["cycle"]["steps"] == {"count": 2, "by": "crossings"}- overlap = report["wrap_overlap"]- assert overlap["seam"] > loop.SEAM_RATIO_MAX and overlap["seam_max"] == loop.SEAM_RATIO_MAX- assert (overlap["skipped"], overlap["tries"], overlap["frames"], overlap["calls"]) == ("turned off (--overlap-wrap off)", [], [], 0)- assert reads.reads == 0 and "interpolator" not in overlap and "torso" not in overlap- assert "overlapped" not in report["jump_repair"]- err = capsys.readouterr().err- assert ("video-loop: warning: the cut's wrap does not close (seam " in err- and "the overlapped wrap was not made: turned off (--overlap-wrap off) (docs/loop-repair.md section 2)" in err)---def test_the_cli_passes_overlap_wrap_off_and_on_is_its_default(tmp_path, monkeypatch, capsys):- """`sprite-gen video-loop --overlap-wrap off`, as a caller on a CPU passes it, reaches the cut: no RIFE is installed- here, and the record says the wrap was turned off, not that RIFE is missing. Without the flag the wrap is on; another- word is refused."""+def test_with_the_overlapped_wrap_off_nothing_is_read_for_the_wrap_and_the_gate_refuses_the_cut_as_filmed(tmp_path, monkeypatch, capsys):+ """`sprite-gen video-loop --overlap-wrap off`, as a caller passes it on a host whose RIFE runs on a CPU, where one frame+ of the wrap takes minutes: the wrap the gate refuses is not made again. Nothing is read for it — no RIFE is installed+ here, and the record says the wrap was turned off, not that RIFE is missing — and the gate refuses the cut as filmed:+ the loop fails on its seam, as it does where every run is refused. Without the flag the wrap is on; another word is+ refused."""parser = argparse.ArgumentParser()loop.add_arguments(parser)assert parser.parse_args(["--frames-dir", "k", "--out-dir", "o"]).overlap_wrap == "on"@@ -328,19 +300,31 @@ def test_the_cli_passes_overlap_wrap_off_and_on_is_its_default(tmp_path, monkeypwith pytest.raises(SystemExit, match="^video-loop: loop seam ratio"):loop.main(["--frames-dir", str(keyed), "--out-dir", str(tmp_path / "out"), "--fps", "24.0", "--state", "walk","--anchor", "motion-auto", "--report", str(tmp_path / "loop.json"), "--overlap-wrap", "off"])- overlap = json.loads((tmp_path / "loop.json").read_text())["wrap_overlap"]- assert overlap["skipped"] == "turned off (--overlap-wrap off)" and overlap["calls"] == 0 and "rife" not in overlap+ report = json.loads((tmp_path / "loop.json").read_text())+ assert report["status"] == "failed" and report["error"].startswith("video-loop: loop seam ratio")+ assert report["cycle"]["steps"] == {"count": 2, "by": "crossings"}+ overlap = report["wrap_overlap"]+ assert overlap["seam"] > loop.SEAM_RATIO_MAX and overlap["seam_max"] == loop.SEAM_RATIO_MAX+ assert (overlap["skipped"], overlap["tries"], overlap["frames"], overlap["calls"]) == ("turned off (--overlap-wrap off)", [], [], 0)+ # a frame read for the wrap looks for RIFE first, and where none is installed the record names it missing+ assert "rife" not in overlap and "interpolator" not in overlap and "torso" not in overlap+ assert "overlapped" not in report["jump_repair"]+ err = capsys.readouterr().err+ assert ("video-loop: warning: the cut's wrap does not close (seam " in err+ and "the overlapped wrap was not made: turned off (--overlap-wrap off) (docs/loop-repair.md section 2)" in err)with pytest.raises(SystemExit, match="unknown --overlap-wrap 'auto'"):loop.run_loop(keyed, tmp_path / "again", fps=24.0, state="walk", min_len=None, max_len=None, n_out=None,seam_max=loop.SEAM_RATIO_MAX, name="loop", report_path=None, anchor="motion-auto", overlap_wrap="auto")def test_the_cut_as_filmed_is_refused_at_the_seam_with_the_repair_off(tmp_path):report = _cut(tmp_path, _keyed(tmp_path), repair_mode="off")assert report["status"] == "failed" and report["error"].startswith("video-loop: loop seam ratio")assert report["cycle"]["steps"] == {"count": 2, "by": "crossings"} and "wrap_overlap" not in reportdef test_without_rife_the_wrap_is_cut_as_filmed_and_says_so(tmp_path, monkeypatch, capsys):_no_rife(monkeypatch, tmp_path)report = _cut(tmp_path, _keyed(tmp_path))@@ -350,6 +334,7 @@ def test_without_rife_the_wrap_is_cut_as_filmed_and_says_so(tmp_path, monkeypatcassert "the overlapped wrap was not made" in capsys.readouterr().errdef test_without_rife_and_the_repair_on_the_loop_fails_asking_for_it(tmp_path, monkeypatch):_no_rife(monkeypatch, tmp_path)report = _cut(tmp_path, _keyed(tmp_path), repair_mode="on")@@ -366,6 +351,7 @@ def _stopped(tried: dict) -> dict:return stoppeddef test_a_made_frame_with_a_fault_ends_its_run_and_the_wrap_is_cut_as_filmed(tmp_path, capsys):"""A stand-in that returns nothing: each run ends at the first frame it makes (`fault`), the rest of it not made, eachwidth tried once, and the gate refuses the cut as filmed."""@@ -406,6 +392,7 @@ class Torn(Between):return frame, apartdef test_a_frame_its_passes_disagree_on_ends_its_run_and_the_wrap_is_cut_as_filmed(tmp_path, capsys):"""The first walker with a stand-in whose passes disagree over a patch of its body on a frame made far from both of itstwo: each run makes the frame nearest a half first, reads it torn, and ends there, the rest of it not made; every@@ -479,6 +466,7 @@ def _painted(tail: float) -> Image.Image:return Image.fromarray(np.uint8(np.clip(f, 0, 1) * 255 + 0.5), "RGBA")@pytest.mark.real_rife@pytest.mark.timeout(900) # 102 calls of the binary at 480 x 640: over a minute on a GPU, minutes on a CPU's Vulkan driverdef test_real_rife_a_frame_made_across_a_hand_is_torn_and_refused_and_a_short_swing_is_kept():diff --git a/tests/video/test_loop_prop_seam.py b/tests/video/test_loop_prop_seam.pyindex 470ace4..9bede2c 100644--- a/tests/video/test_loop_prop_seam.py+++ b/tests/video/test_loop_prop_seam.py@@ -77,6 +77,7 @@ def _wrap_over_step(start: int, length: int, phase: float) -> float:return abs(_tip(start, phase) - _tip(start + length - 1, phase)) / innerdef test_motion_auto_does_not_cut_where_the_staff_jumps(tmp_path):keyed = _keyed(tmp_path, [_walker(k) for k in range(73)])out = tmp_path / "out"@@ -103,6 +104,7 @@ def test_motion_auto_does_not_cut_where_the_staff_jumps(tmp_path):assert not any("jumps into the loop's first frame" in line for line in report["jolt"]["warnings"])def test_a_window_whose_top_cannot_be_read_is_not_taken_as_closing(tmp_path):"""One frame (50) has the staff's tip flung 90 px up: every window holding it has a frame with nothingin the top band, and its pop cannot be read. Such a window is neither calm nor chosen; before, it was@@ -175,6 +177,7 @@ def test_a_refused_window_whose_top_cannot_be_read_is_not_listed_as_closing():assert (r["seam_pop"] is None) == (kinds[r["start"], r["length"]] == "unread") == ("seam_pop_skipped" in r)def test_a_cut_without_a_part_on_its_own_beat_is_chosen_as_before(tmp_path):"""No staff: the wrap does not pop, nothing past the first choice is measured."""keyed = _keyed(tmp_path, [_walker(k, staff=False) for k in range(73)])@@ -251,6 +254,7 @@ def test_a_search_that_finds_nothing_reports_the_windows_it_refused():assert r["start"] >= 0 and r["length"] >= 12 and r["start"] + r["length"] <= 80def test_a_refused_motion_auto_cut_leaves_measured_windows_in_the_report(tmp_path):"""The legs spread apart over the clip and never come back: the search refuses, and the reportnames windows to deliver from anyway (before, `cycle` was null and a forced cut took the whole clip)."""diff --git a/tests/video/test_loop_prop_seam_held.py b/tests/video/test_loop_prop_seam_held.pyindex 22db60a..9476763 100644--- a/tests/video/test_loop_prop_seam_held.py+++ b/tests/video/test_loop_prop_seam_held.py@@ -119,6 +119,7 @@ def staffless(staffless_cut, tmp_path) -> tuple[Path, dict]:return root, json.loads((root / "out" / "loop.loop.report.json").read_text())def test_motion_auto_takes_two_steps_where_the_held_staff_closes_only_there(held):root, report = heldcycle = report["cycle"]@@ -144,6 +145,7 @@ def test_motion_auto_takes_two_steps_where_the_held_staff_closes_only_there(heldassert not any("held part" in line for line in report["jolt"]["warnings"])def test_a_held_part_that_swings_with_the_step_is_cut_one_step_long(tmp_path):"""A pennant at the tip sways on a beat of its own (53 frames) and pops at the first choice; thestaff stands straight above the hand and swings with the step below it, so a one-step cut whose@@ -159,6 +161,7 @@ def test_a_held_part_that_swings_with_the_step_is_cut_one_step_long(tmp_path):assert _foot_miss(cycle["start"], cycle["length"], STEP) <= 0.5def test_a_held_part_no_window_closes_is_kept_on_the_top_bands_choice_and_warned(tmp_path):"""The foot swings every 37 frames: neither one step nor two closes it. The cut is the top band's,and the jolt says the held part does not close."""@@ -171,6 +174,7 @@ def test_a_held_part_no_window_closes_is_kept_on_the_top_bands_choice_and_warnedassert len(lines) == 1 and "right side" in lines[0]def test_an_explicit_max_len_is_not_widened_by_a_window_two_steps_long(tmp_path):"""--max-len 25 is the caller's ceiling: the windows two steps long (47-49 frames) that would closethe staff are over it and are not read. The cut is the top band's, one step long, and the jolt says@@ -358,6 +362,7 @@ def test_shape_rank_reads_no_held_side_when_the_first_choice_does_not_pop():# --- the set ----------------------------------------------------------------------------------def test_cycle_align_aligns_a_two_step_loop_as_the_one_cycle_it_is(held, staffless):"""The loop cut two steps long is one cycle: it returns half way at its second step, which is nosuspect (status `steps`), and it is resampled to the set's length like the rest — the set's lengthdiff --git a/tests/video/test_motion_anchor.py b/tests/video/test_motion_anchor.pyindex 2c74eab..f63e52a 100644--- a/tests/video/test_motion_anchor.py+++ b/tests/video/test_motion_anchor.py@@ -243,6 +243,7 @@ def test_the_search_window_reads_each_shift_as_one_patch_read_alone_did(case):assert batched[0] == {"search-boundary": "boundary", "flat": "none"}.get(case, "match")def test_a_960_cut_is_corrected_in_a_fraction_of_the_time_reading_one_patch_at_a_time_takes():"""Performance watch: the search of a 960 px cut, regions of some 30 000 mask pixels as a 960 px walk's are. Read onepatch at a time, each corrected cut took most of a walk's loop stage, and the seam gate corrects up to fivediff --git a/tests/video/test_one_step_cut.py b/tests/video/test_one_step_cut.pyindex d477ea0..5f00897 100644--- a/tests/video/test_one_step_cut.py+++ b/tests/video/test_one_step_cut.py@@ -99,6 +99,7 @@ def slow(tmp_path_factory) -> tuple[Path, Path, dict]:return root, keyed, _cut(root / "out", keyed)def test_a_walk_cut_one_step_long_is_named_by_the_step_screen(slow):_, _, report = slowcycle = report["cycle"]@@ -133,6 +134,7 @@ def _same_but_the_screen(a: Path, b: Path) -> None:assert left == right@pytest.mark.parametrize("cycle, suspect", [(CYCLE, True)])def test_the_step_screen_changes_nothing_but_its_own_record(tmp_path, monkeypatch, cycle, suspect):"""A one-step cut: with the screen or without it, every image, the strip metadata and the report@@ -146,6 +148,7 @@ def test_the_step_screen_changes_nothing_but_its_own_record(tmp_path, monkeypatc_same_but_the_screen(tmp_path / "screened", tmp_path / "unscreened")@pytest.mark.parametrize("cycle, suspect", [(23.5, True), (25, False)])def test_the_step_screen_reads_a_cycle_on_a_frame_count_that_is_not_whole(tmp_path, cycle, suspect):"""A cycle of 23.5 frames repeats better twice over, being whole there: a suspect that is no step.@@ -153,6 +156,7 @@ def test_the_step_screen_reads_a_cycle_on_a_frame_count_that_is_not_whole(tmp_paassert _cut(tmp_path / "out", _keyed(tmp_path, cycle))["cycle"]["step_screen"]["suspect"] is suspectdef test_steps_1_cuts_the_walk_again_two_steps_long_where_its_arms_close(slow, tmp_path):root, keyed, first = slowreport = _cut(tmp_path / "out", keyed, "--steps", "1")@@ -171,6 +175,7 @@ def test_steps_1_cuts_the_walk_again_two_steps_long_where_its_arms_close(slow, tassert strip["steps"] == 2 and strip["cycle_frames"] == cycle["length"]def test_steps_2_keeps_the_cut_and_records_the_count(slow, tmp_path):root, keyed, first = slowreport = _cut(tmp_path / "out", keyed, "--steps", "2")@@ -181,6 +186,7 @@ def test_steps_2_keeps_the_cut_and_records_the_count(slow, tmp_path):assert (tmp_path / "out" / name).read_bytes() == (root / "out" / name).read_bytes()def test_a_counted_cut_the_clip_cannot_see_repeat_is_cut_and_warned_about(tmp_path):"""50 frames hold the 42-frame cycle with 8 to spare: no window that long is seen repeating. Thecount stands for the repeat, the cut whose wrap the clip plays is taken, and its coverage — under a@@ -196,6 +202,7 @@ def test_a_counted_cut_the_clip_cannot_see_repeat_is_cut_and_warned_about(tmp_paassert report["resampled_seam_ratio"] <= loop.SEAM_RATIO_MAXdef test_an_explicit_window_past_half_the_clip_is_the_window(slow, tmp_path):"""--min-len 41 --max-len 43 asks for the cycle the window could not hold. v2.35.0 cut the ceilingback to half the clip (36) and found no window [41, 36]; the caller's ceiling is the ceiling."""@@ -221,6 +228,7 @@ def _set(root: Path, side: Path) -> list[Path]:return dirsdef test_cycle_align_stops_on_a_loop_that_may_be_one_step_and_names_the_count_that_settles_it(slow, tmp_path):root, keyed, _ = slowwhole = _keyed(tmp_path / "whole", cycle=25)@@ -242,22 +250,9 @@ def test_cycle_align_stops_on_a_loop_that_may_be_one_step_and_names_the_count_thassert out["applied"] is True and out["suspects"][0]["status"] == "counted"-def test_cycle_align_takes_the_loop_cut_again_on_its_count(slow, tmp_path):- root, keyed, _ = slow- whole = _keyed(tmp_path / "whole", cycle=25)- _cut(tmp_path / "front", whole)- _cut(tmp_path / "recut", keyed, "--steps", "1")- dirs = _set(tmp_path, tmp_path / "recut")- out = align.align_set(dirs, between="nearest")- lengths = [json.loads((d / "loop.loop.report.json").read_text())["cycle"]["length"] for d in dirs]- assert out["applied"] is True and out["length"] == round((lengths[0] + lengths[1]) / 2)- (entry,) = out["suspects"] # its half is its step: no suspect to stop on- assert entry["dir"] == str(dirs[1].resolve()) and entry["status"] == "steps" and [c["cycles"] for c in entry["candidates"]] == [2]- assert all("cycles_kept" not in row for row in out["loops"])--# --- video-set ----------------------------------------------------------------------------def test_video_set_names_a_loop_that_may_be_one_step_and_its_table_says_so(slow, tmp_path, capsys):"""A video-set item keeps the cut's report beside its loop directory (`<item>/loop.report.json`):the alignment reads the step screen there, and the set stops on the side walk with what settles it."""diff --git a/tests/video/test_outline_shift.py b/tests/video/test_outline_shift.pyindex 9e83112..9aa9324 100644--- a/tests/video/test_outline_shift.py+++ b/tests/video/test_outline_shift.py@@ -178,6 +178,7 @@ def test_a_boot_washed_lighter_on_art_painted_without_a_line_is_refused_on_the_dassert max(rife.outlined(a), rife.outlined(b)) < 0.1 and min(rife.outlined(_two_tone(*FAR[0])), rife.outlined(_walker(20, -20))) > 0.99@pytest.mark.real_rifedef test_real_rife_keeps_a_mid_tone_line_through_a_short_step_and_loses_it_crossing_far():"""Through RIFE, the two-tone legs of a short step come out outlined on the rank reading at everydiff --git a/tests/video/test_parts.py b/tests/video/test_parts.pyindex 3433d25..ad05284 100644--- a/tests/video/test_parts.py+++ b/tests/video/test_parts.py@@ -226,6 +226,7 @@ def _bytes(frames) -> list[bytes]:return [np.asarray(f).tobytes() for f in frames]def test_a_tail_behind_the_body_is_read_where_it_is_drawn_on_every_frame():# Every frame of the clip, and frames made between two read at the time they show: none left out of the bounds.masker = _masker("side")@@ -239,6 +240,7 @@ def test_a_tail_behind_the_body_is_read_where_it_is_drawn_on_every_frame():assert sum(_crossed(t) for t in range(N)) >= 4@pytest.mark.parametrize("reading", ["clip", "wrap"])@pytest.mark.parametrize("walker, rare", [("side", parts.RARE), ("back", parts.RARE), ("back_bushy", parts.RARE),("side", parts.RARE / 2), ("side", 2 * parts.RARE),@@ -255,6 +257,7 @@ def test_in_front_of_the_body_or_behind_it_is_read_from_the_clip(walker, rare, rassert read["order"] == "front" and read["front_share"] > parts.FRONT + 0.05, readdef test_a_lay_reads_the_order_from_the_frames_beside_the_wrap_alone(monkeypatch):# A lay reads the rims of the clip's frames within WRAP of the wrap, on either side and in every cycle, and of no# other frame.diff --git a/tests/video/test_rife.py b/tests/video/test_rife.pyindex 3bf04e0..8f41f22 100644--- a/tests/video/test_rife.py+++ b/tests/video/test_rife.py@@ -171,6 +171,7 @@ def _premultiplied(frame: Image.Image) -> np.ndarray:return np.concatenate([colour * cover, cover], axis=-1)def test_read_makes_the_frame_as_every_call_and_reads_sixteen_single_passes_turned_back(monkeypatch, tmp_path):"""`Rife.read`: the frame as `between` makes it, with the augmentation every call asks for, then the sixteen singlepasses with none — the pair flipped and transposed eight ways, each from a to b at t and from b to a at 1 - t. A binary@@ -229,6 +230,7 @@ def test_real_rife_makes_the_frame_between_in_colour_and_alpha():assert interpolate.made == 1@pytest.mark.real_rifedef test_real_rife_between_crossing_legs_adds_no_black():"""Two outlined legs walk through each other (the near one forward, the far one back): where they@@ -323,6 +325,7 @@ def test_outline_loss_reads_a_melted_limb_and_not_a_moved_one():assert rife.smear(flat[2], flat[0], flat[1])["outline_loss"] <= 0.01@pytest.mark.real_rife@pytest.mark.timeout(900) # 20 calls of the binary at 128 x 192, each run 16 ways (-x -z): seconds on a GPU, minutes on a CPU's Vulkan driverdef test_real_rife_melts_legs_crossing_too_far_and_alignment_takes_the_nearer_frame_there():diff --git a/tests/video/test_seam_bridge.py b/tests/video/test_seam_bridge.pyindex 59f8955..ae1c91a 100644--- a/tests/video/test_seam_bridge.py+++ b/tests/video/test_seam_bridge.py@@ -118,6 +118,7 @@ def _cells(out: Path) -> list[np.ndarray]:return [np.asarray(Image.open(p)) for p in sorted((out / "cycle").glob("frame-*.png"))]def test_a_wrap_that_jumps_is_bridged_by_one_frame_and_the_loop_then_passes_the_gate(tmp_path):phases = _phases(2.6)keyed = _keyed(tmp_path, phases)@@ -167,6 +168,7 @@ def test_the_fewest_frames_are_tried_first_and_a_straight_line_that_does_not_cloassert f"frames {N - 2}, {N - 1}, 0, 1 were made again by RIFE between frames {N - 3} and 2" in linedef test_a_wrap_that_reads_as_a_step_needs_no_interpolator_and_is_cut_as_before(tmp_path):keyed = _keyed(tmp_path, _phases(1.0))off = _run(tmp_path / "off", keyed, repair="off")@@ -272,6 +274,7 @@ def test_repair_on_without_rife_refuses_a_wrap_to_bridge(tmp_path, monkeypatch):assert report["status"] == "failed" and "rife-ncnn-vulkan not found" in report["error"]def test_repair_on_refusing_a_wrap_to_bridge_hands_nothing_over(tmp_path, monkeypatch):"""A refused run hands nothing over (docs/video-pipeline.md section 4, `loop.refuse`): the seam bridge's refusaltakes back what an earlier cut in the same folder handed over, as every other `video-loop` refusal does."""@@ -324,6 +327,7 @@ def test_the_summary_names_the_frames_made_and_the_rife_that_made_them(tmp_path,"tta": "", "binary_calls": 2}@pytest.mark.real_rifedef test_rife_bridges_a_wrap_that_jumps_without_a_fault(tmp_path):rep = _run(tmp_path, _keyed(tmp_path, _phases(2.6)))diff --git a/tests/video/test_source_restoration.py b/tests/video/test_source_restoration.pyindex 5e9be2d..540870f 100644--- a/tests/video/test_source_restoration.py+++ b/tests/video/test_source_restoration.py@@ -163,6 +163,7 @@ def repaint_source(case, index, paint):return framedef test_source_restoration_preserves_normal_motion_and_timing(case,tmp_path):result=repair(case,tmp_path)assert result['status']=='candidate' and result['schema_version']==REPAIR_SCHEMA@@ -193,6 +194,7 @@ def test_source_restoration_preserves_normal_motion_and_timing(case,tmp_path):assert receipt['applied'][0]['proposal_id']==result['proposal_id']==comparison['restoration']['proposal_id']def test_next_independent_proposal_and_budget(case,tmp_path):first,second=repair(case,tmp_path,1),repair(case,tmp_path,2)assert first['target']!=second['target'] and first['proposal_id']!=second['proposal_id']@@ -238,6 +240,7 @@ def test_missing_source_is_error_and_follow_is_shared_unknown(case,tmp_path):with pytest.raises(FileNotFoundError): source.Source.read(**inputs)@pytest.mark.parametrize('mutation',['freeze','colour','alpha','duration','crop','report','receipt'])def test_tampered_final_artifacts_are_not_accepted(case,tmp_path,mutation):r=repair(case,tmp_path)@@ -308,6 +311,7 @@ def test_cli_real_json_needs_the_origin(case,tmp_path,capsys):assert c['origin']['artifacts']==r['origin_artifacts']def test_key_spill_stays_out_and_the_rest_of_the_cell_is_restored(case,tmp_path):# A real source pixel can still be bad: copying it would bring key tint the delivered cell lacks.# Those places keep the delivered pixel; every other differing place is the source's.@@ -364,6 +368,7 @@ def test_colours_beside_the_key_hue_are_copied_and_a_key_accent_is_left(case,tmpassert r['partial']['protected']['count']==1def test_less_total_key_spill_cannot_hide_new_local_key_spill(case,tmp_path):paths,inputs,_=case# More green is removed at one location than the source would bring at a different one.@@ -541,6 +546,7 @@ def recolour_outline(colour):return paintdef test_protected_outline_leaves_the_fault_and_is_not_adopted(case,tmp_path):# The source's outline is dark and key tinted: every outline pixel is protected, with the same coverage.# The copy then restores too little to clear the fault, and nothing else makes it an improvement.@@ -627,6 +633,7 @@ def adopted(case,tmp_path):return origin,first,outputs(first)def test_later_request_rebuilds_the_new_baseline_from_the_origin(case,tmp_path,adopted):origin,first,current=adopted# The restored cell is not the source's whole cell, and is still verified: it is rebuilt from the origin.@@ -664,6 +671,7 @@ REBUILT='not reproduced by the origin'; PIXELS='pixels differ from the origin reOUTSIDE='differs from the origin outside its restoration receipt'@pytest.mark.parametrize('tamper,refusal',[('mask_run',REBUILT),('protected_pixel',PIXELS),('list_emptied','lists no applied cell'),('receipt_removed','carries no restoration receipt'),@@ -730,6 +738,7 @@ def test_other_policy_receipt_is_not_read_as_this_one(case,tmp_path,adopted):assert not (tmp_path/'other-policy').exists()def test_old_proposal_cannot_be_compared_on_the_new_baseline(case,tmp_path,adopted):origin,first,current=adoptedsecond=repair(case,tmp_path,baseline=current,origin=origin,out='next-request')@@ -781,6 +790,7 @@ def test_the_jump_around_a_restored_cell_is_the_jump_repairs_own_score(tmp_path,assert axis['cells'][0]['candidate']<=axis['cells'][0]['baseline'] and axis['status']!='regressed'@pytest.mark.parametrize('facing',['right'])def test_a_restored_cell_that_brings_its_jump_back_is_not_improved(tmp_path,facing):# The source frame under the melted cell is the jump the repair took out: its whole drawing stands@@ -818,6 +828,7 @@ def test_a_jump_repair_record_without_its_facing_is_shared_unknown(case,tmp_pathassert noop['comparison']['axes']['jump']=={'facing':None,'cells':[],'status':'non_regressing','reason':'no-jump-repaired-cell'}@pytest.mark.parametrize('scaled,left,right,mixed,capped',[('green',WARM,COOL,(105,114,105,255),(105,113,105,255))],indirect=['scaled'])def test_cli_restores_a_resampled_cell_with_its_made_excess_capped(scaled,tmp_path,left,right,mixed,capped):@@ -877,6 +888,7 @@ def capped_baseline(scaled,tmp_path):return scaled[0],first,outputs(first)def test_capped_cell_is_rebuilt_from_the_origin_by_later_requests(scaled,tmp_path,capped_baseline):origin,first,current=capped_baselinesecond=repair(scaled,tmp_path,baseline=current,origin=origin,out='next-request')@@ -895,6 +907,7 @@ def test_capped_cell_is_rebuilt_from_the_origin_by_later_requests(scaled,tmp_patassert all(outputs(third)[k].read_bytes()==final[k].read_bytes() for k in final)@pytest.mark.parametrize('tamper,refusal',[('capped_mask',REBUILT),('uncapped_pixel',PIXELS)])def test_changed_capped_cell_or_its_receipt_is_error(scaled,tmp_path,capped_baseline,tamper,refusal):origin,first,current=capped_baselinediff --git a/tests/video/test_stop.py b/tests/video/test_stop.pyindex be57fcf..fcb65fe 100644--- a/tests/video/test_stop.py+++ b/tests/video/test_stop.py@@ -152,6 +152,7 @@ def test_stop_plays_the_start_backwards_from_the_loop_to_the_first_frame(tmp_patassert report["status"] == "passed" and report["shown"] == showndef test_stop_does_not_slide_when_the_body_drifts_as_it_sets_off(tmp_path):"""A clip whose body moves 36 px across and 18 px up while it sets off, beside the same clip filmed in place: playedback as filmed, the first would slide that far into the still. Its stop is the in-place clip's, the drift taken out@@ -200,6 +201,7 @@ def test_stop_refuses_a_short_other_motion(tmp_path, other):assert not (tmp_path / "stop" / "stop.strip.png").exists()def test_stop_refuses_a_start_that_holds_another_motion(tmp_path):"""Two and a half cycles of another motion between the still and the run: it turns back again and again, and therun-up is past the run-up bound too. Refused as another motion, the report written; the run-up bound, which only@@ -216,6 +218,7 @@ def test_stop_refuses_a_start_that_holds_another_motion(tmp_path):make(tmp_path, keyed, meta, run_up_max=4.0)def test_stop_refuses_a_run_up_longer_than_a_setting_off(tmp_path):"""A start whose stride grows over two and a half cycles goes one way into the run — nothing in it turns back — andplays strides unlike the loop's for longer than a setting-off: refused by its length, not as another motion, the@@ -243,6 +246,7 @@ def test_stop_refuses_a_seam_past_the_jump_line(tmp_path):assert report["status"] == "failed" and report["seam"]["steps"] > stop.SEAM_MAXdef test_stop_leaves_an_aligned_loop_from_the_cell_nearest_the_entry(tmp_path):"""A loop turned to start elsewhere (as video-cycle-align turns one): the cell left from follows the pose, not the index."""keyed, run_from = clip(tmp_path)diff --git a/tests/video/test_walk_steps.py b/tests/video/test_walk_steps.pyindex 9562043..c40ac79 100644--- a/tests/video/test_walk_steps.py+++ b/tests/video/test_walk_steps.py@@ -23,7 +23,6 @@ from __future__ import annotationsimport jsonimport math-import shutilfrom pathlib import Pathimport numpy as np@@ -31,7 +30,7 @@ import pytestfrom PIL import Image, ImageDrawfrom conftest import feet_unseen-from sprite_gen.video import align, crossings, local_cycle, loop+from sprite_gen.video import crossings, local_cycle, loopFRAMES = 73@@ -183,6 +182,7 @@ def _two_steps(report: dict, cycle: float) -> dict:return counteddef test_a_half_step_diagonal_walk_is_cut_two_steps(tmp_path):"""Legs drawn alike, 14.5 frames a step, a tail on a 45-frame beat: one step on, the legs are swapped and thetail is nearer where it was than a cycle on, so the search takes 14 frames — one foot goes forward. The@@ -200,6 +200,7 @@ def test_a_half_step_diagonal_walk_is_cut_two_steps(tmp_path):assert screen["suspect"] is False and (screen.get("settled_by") == "crossings" or "pixel_suspect" not in screen)def test_a_walk_slower_than_the_window_is_cut_two_steps(tmp_path):"""A 46-frame cycle (1.92 s) in a 73-frame clip: past the window's 36, so the search cut a 23-frame step. Twosteps are 46 frames, and the clip holds 0.59 of a cycle past them."""@@ -210,6 +211,7 @@ def test_a_walk_slower_than_the_window_is_cut_two_steps(tmp_path):assert report["cycle"]["coverage"] == round((FRAMES - report["cycle"]["length"]) / report["cycle"]["length"], 4) > loop.COVERAGE_MINdef test_a_tail_on_its_own_beat_no_longer_cuts_three_steps(tmp_path):"""A front walk, 13.5 frames a step, its big tail on a 41-frame beat: the search refuses the walk's 27 frames(repeat error over two steps), and the gait fallback takes the tail's 41 — three steps, the wrap putting the@@ -220,6 +222,7 @@ def test_a_tail_on_its_own_beat_no_longer_cuts_three_steps(tmp_path):assert "gait_fallback" in report and counted["search"]["k"] == [3] and counted["search"]["cut"][1] in (40, 41, 42)def test_a_slow_walk_in_a_short_clip_the_search_refuses_is_cut_two_steps(tmp_path):"""A 34-frame front walk with a tail on a 52-frame beat: no window repeats within two steps of its own, so thesearch and the gait fallback find no cycle. The crossings show two."""@@ -228,6 +231,7 @@ def test_a_slow_walk_in_a_short_clip_the_search_refuses_is_cut_two_steps(tmp_patassert counted["search"]["refused"].startswith("no periodic cycle found")def test_a_walk_that_stalls_is_not_cut_across_the_stalled_step(tmp_path):"""A side walk held still 20 frames: the step the hold is in is far longer than the walk's own, and no frame ofit is played (the search's cut played its last frames, and its seam did not close)."""@@ -242,6 +246,7 @@ def test_a_walk_that_stalls_is_not_cut_across_the_stalled_step(tmp_path):assert counted["search"]["code"] == "step-long"@pytest.mark.parametrize("cycle, hold", [(20, 2), (24, 3)])def test_a_held_walk_whose_far_foot_hides_is_cut_one_cycle(tmp_path, cycle, hold):"""Seen from behind on a diagonal, on twos or threes, the far foot passes hidden behind the near one: one crossing@@ -262,6 +267,7 @@ def test_a_held_walk_whose_far_foot_hides_is_cut_one_cycle(tmp_path, cycle, holdassert c["method"] == "local-repeat-drift-v1"@pytest.mark.parametrize("tone, lean", [(1, 0), (4, 1)])def test_a_side_walk_whose_two_steps_look_alike_is_cut_two_steps_however_near_a_step_on(tmp_path, tone, lean):"""The case the count was made for, guarded: from the side the two steps are one silhouette, the near leg and arm@@ -275,6 +281,7 @@ def test_a_side_walk_whose_two_steps_look_alike_is_cut_two_steps_however_near_a_assert "same_picture" not in counted["search"]def test_a_cut_of_two_steps_that_does_not_close_leaves_the_searchs_cut(tmp_path):"""On threes, a big tail on its own beat: the search's cut is one the count does not refute (it plays feet heldtogether past a pass: uncertain), and every cut of two steps leaves the tail open at the wrap, out of phase, its@@ -299,6 +306,7 @@ def _same_cut(a: Path, b: Path) -> None:assert all((a / "cycle" / f).read_bytes() == (b / "cycle" / f).read_bytes() for f in frames)def test_a_walk_the_search_cuts_two_steps_in_phase_is_cut_as_before(tmp_path):"""The same front walk with a small tail: the search cuts its 27 frames, two steps joined at the walk's own point,and the cut is kept — every image as the search alone cut it; the strip says `steps: 2`."""@@ -315,6 +323,7 @@ def test_a_walk_the_search_cuts_two_steps_in_phase_is_cut_as_before(tmp_path):assert strips[0].pop("steps") == 2 and "steps" not in strips[1] and strips[0] == strips[1]def test_a_body_with_no_feet_to_read_is_cut_as_the_search_cuts_it(tmp_path):keyed = _keyed(tmp_path, _blob, frames=64)report = _cut(tmp_path / "out", keyed)@@ -324,6 +333,7 @@ def test_a_body_with_no_feet_to_read_is_cut_as_the_search_cuts_it(tmp_path):assert "steps" not in report["cycle"] and "steps" not in json.loads((tmp_path / "out" / "loop.strip.json").read_text())def test_a_count_given_is_the_word_on_the_searchs_cut(tmp_path):"""--steps counts the cut the search takes: the crossings are not asked."""report = _cut(tmp_path / "out", _keyed(tmp_path, lambda k: _side(k, cycle=46, phase=13)), "--steps", "2")@@ -331,20 +341,6 @@ def test_a_count_given_is_the_word_on_the_searchs_cut(tmp_path):assert report["cycle"]["length"] in (22, 23, 24) # the search's one step, kept on the count-def test_cycle_align_takes_a_loop_cut_two_steps_as_one_cycle(tmp_path):- """The half-step walk cut two steps long returns half way at its second step; its loop says `steps: 2`, so the- alignment reads that return as its step, and the set aligns."""- _cut(tmp_path / "a", _keyed(tmp_path / "ka", lambda k: _side(k, cycle=29, tail_cycle=45, tail=60, arms=False)))- _cut(tmp_path / "b", _keyed(tmp_path / "kb", lambda k: _side(k, cycle=46, phase=13)))- dirs = []- for name in ("a", "b"):- shutil.copytree(tmp_path / name, tmp_path / "set" / name)- dirs.append(tmp_path / "set" / name)- out = align.align_set(dirs, between="nearest")- assert out["applied"] is True- assert all(entry["status"] == "steps" for entry in out["suspects"])--def _distances(period: int = 13, frames: int = 120) -> np.ndarray:t = np.arange(frames)angle = t * 2 * np.pi / perioddiff --git a/tests/video/test_wrap_blend.py b/tests/video/test_wrap_blend.pyindex 4a24b82..44e2ad8 100644--- a/tests/video/test_wrap_blend.py+++ b/tests/video/test_wrap_blend.py@@ -338,6 +338,7 @@ def outputs(out_dir: Path, cells: str = "cycle") -> dict[str, bytes]:REDRAW = {"redraw": 0.0, "strands": 0.0, "breath": 6.0} # the model's tone and 0.5 px of softness, nothing elsedef test_a_pin_that_redraws_the_first_frame_has_its_wrap_blended_to_under_a_step(tmp_path: Path) -> None:frames = character(**REDRAW)# The blend alone: an idle's wrap that jumps is the seam bridge's too (docs/loop-repair.md section 2), which cuts@@ -361,6 +362,7 @@ def test_a_pin_that_redraws_the_first_frame_has_its_wrap_blended_to_under_a_step# --- 2. a ramp cell that does not stand where the pin stands ---------------------------------------------------------------def test_a_cell_whose_arm_is_not_yet_where_the_pin_holds_it_keeps_its_arm_as_filmed() -> None:frames = list(character("attack-late"))assert pin_closes(frames)@@ -406,6 +408,7 @@ def _part_on_the_torso(d: int, mode: str = "move") -> tuple[list[np.ndarray], npreturn frames, ((frames[0] != base[0]).any(-1) | (frames[-1] != base[-1]).any(-1))@pytest.mark.parametrize("d,mode", [(2, "move"), (8, "move"), (32, "move"), (16, "appear"), (16, "vanish")])def test_a_part_moved_on_a_redrawn_character_is_held_while_the_rest_is_blended(d: int, mode: str) -> None:frames, region = _part_on_the_torso(d, mode)@@ -415,6 +418,7 @@ def test_a_part_moved_on_a_redrawn_character_is_held_while_the_rest_is_blended(dassert identical(out, frames, region)def test_the_checkpoints_part_on_a_flat_figure_is_cut_as_filmed_with_a_warning(tmp_path: Path, capsys) -> None:frames = []for t in range(N):@@ -483,6 +487,7 @@ def test_a_strand_off_the_silhouette_is_held_over_white_where_black_alone_lets_i# --- 7. the softness match -----------------------------------------------------------------------------------------------@pytest.mark.parametrize("kw,expected", [({}, {"sigma": 0.5, "blurred": "still"}), # the model draws 0.5 px softer: the still is blurred({"sigma_still": 0.5, "sigma_model": 0.0}, {"sigma": 0.5, "blurred": "pin"}), # the still is the softer: the pin@@ -507,6 +512,7 @@ def test_a_pin_that_is_the_first_frame_again_leaves_every_output_byte_for_byte(t# --- 9. cuts the blend does not read -------------------------------------------------------------------------------------------def test_a_cut_that_is_not_pinned_is_not_touched(tmp_path: Path) -> None:# The redraw's wrap reads 2.9x the mean step on the seam gate's thumbnail: the gate is opened past it for both cuts.frames = character(**REDRAW)@@ -517,6 +523,7 @@ def test_a_cut_that_is_not_pinned_is_not_touched(tmp_path: Path) -> None:assert outputs(tmp_path / "auto") == outputs(tmp_path / "off")def test_a_pinned_cut_the_body_anchor_moves_is_not_touched(tmp_path: Path) -> None:frames = character(**REDRAW)report = cut(tmp_path, keyed(tmp_path, frames), "auto", anchor="body")@@ -527,6 +534,7 @@ def test_a_pinned_cut_the_body_anchor_moves_is_not_touched(tmp_path: Path) -> No# --- 10. a pin the gate refuses ------------------------------------------------------------------------------------------------def test_a_pin_the_gate_refuses_fails_as_before_with_its_cut_as_filmed(tmp_path: Path) -> None:frames = list(character(**REDRAW))last = np.zeros_like(frames[-1])@@ -544,6 +552,7 @@ def test_a_pin_the_gate_refuses_fails_as_before_with_its_cut_as_filmed(tmp_path:# --- 11. the after check -------------------------------------------------------------------------------------------------------def test_a_ramp_that_steps_past_the_cut_is_not_used_and_says_so() -> None:# A near-still cut that slides into the model's drawing over its whole length: each step carries a 72nd of the redraw,# each ramp cell takes a 13th of it back, a step the cut never takes.@@ -593,6 +602,7 @@ GROUNDS = {}@pytest.mark.parametrize("name", list(GROUNDS))def test_the_oblique_line_on_a_busier_quiet_ground_changes_by_three_levels_at_most(name: str) -> None:# Read on the gate and the ramp: decode noise on every frame lifts the cut's median step, so the ruler alone keeps