test: tighten wall-check to consecutive run; add warp_endpoints no-mutation test
Some checks failed
CI / Library tests (no torch) (ubuntu-latest, 3.12) (push) Has been cancelled
CI / Library tests (no torch) (ubuntu-latest, 3.13) (push) Has been cancelled
CI / Full dev suite (with torch) (ubuntu-latest, 3.12) (push) Has been cancelled
CI / Full dev suite (with torch) (ubuntu-latest, 3.13) (push) Has been cancelled

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
dog
2026-07-09 18:16:23 +08:00
parent 241a4a41c7
commit 43d28b6254
2 changed files with 22 additions and 5 deletions

View File

@@ -128,9 +128,17 @@ def test_no_sharp_turns_or_walls_near_endpoint() -> None:
# Vertical wall: >=4 consecutive tail points within 2 px of
# the target x while spanning >10 px of y.
near_x = np.abs(tail[:, 0] - end[0]) <= 2.0
run_start = 0
run = 0
for i, flag in enumerate(near_x[:-1]): # exclude final point
run = run + 1 if flag else 0
assert run < 4 or np.ptp(tail[near_x][:, 1]) <= 10.0, (
f"{start}->{end} seed={seed}: vertical wall at target x"
)
for j, flag in enumerate(near_x[:-1]): # exclude final point
if flag:
if run == 0:
run_start = j
run += 1
else:
run = 0
if run >= 4:
span = np.ptp(tail[run_start : j + 1, 1])
assert span <= 10.0, (
f"{start}->{end} seed={seed}: vertical wall at target x"
)