Files
Aislo/resources/tester/test_421_2_violation_lines.py
T
eomsangdonandClaude Opus 5.5 8229a5449b feat(B05 노선 추천 창): 못 지킨 구간 = R · 계류 · 측점만 · 원지반 기울기(참고) 줄 · 시종점 높이 차 알림 (421-2)
- 「제약 못 지킨 구간」 · 「기준 초과」 = 같은 목록에서 원지반 기울기 뺀 수(엔진 419 짝)
- 「원지반 기울기(참고) 최대 … % · 상한 넘는 곳 N」 줄 따로 · 넘는 곳은 풍선
- ends_over_limit 이면 「시종점 높이 차가 상한을 넘음(평균 … %) — 종단으로 못 맞춤 · 노선을 늘려야 함」
- 도움말 글(종단기울기 상한 · 못 지킨 구간 · 원지반 기울기 · 시종점) · 시험 test_421_2 · 옛 시험 단언 고침

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
2026-10-18 13:12:18 +09:00

62 lines
2.6 KiB
Python

"""421-2 추천 창 — 「못 지킨 구간」 = R · 계류 · 측점만 · 원지반 기울기(참고) 줄 · 시종점 알림.
./venv/Scripts/python.exe -m pytest resources/tester/test_421_2_violation_lines.py -q
"""
import json
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
B05 = ROOT / "B05_Profile"
HELPER = Path(__file__).with_name("helper_421_2_violation_lines.cjs")
def _lines() -> dict:
run = subprocess.run(
["node", str(HELPER)], capture_output=True, text=True, encoding="utf-8", check=True
)
return json.loads(run.stdout)
def test_못_지킨_구간은_기울기_빼고_기준_초과와_같음() -> None:
now = _lines()["now"]
assert now["violations"].startswith("제약 못 지킨 구간 2곳: No.3 R 10.0m")
assert "28.8%" not in now["violations"] and "No.5+3.0 측점 밖 3.0m" in now["violations"]
assert now["over"] == 2 and "기준 초과 2구간" in now["route"] # 서버 total 4 아님
assert now["ground"] == "원지반 기울기(참고) 최대 35.8% · 상한 넘는 곳 2"
assert now["groundTitle"].split("\n") == [
"No.1 28.8%(원지반 기울기)",
"No.4 18.9%(원지반 기울기)",
]
assert now["ends"] == (
"시종점 높이 차가 상한을 넘음(평균 16.2%) — 종단으로 못 맞춤 · 노선을 늘려야 함"
)
def test_기울기만_넘으면_모두_지킴_시종점_알림_없음() -> None:
clean = _lines()["clean"]
assert clean["violations"] == "제약 못 지킨 구간 없음 — 모두 지킴"
assert clean["over"] == 0 and clean["ground"].endswith("상한 넘는 곳 1")
assert clean["ends"] == ""
def test_옛_답은_서버_수_그대로_줄_없음() -> None:
old = _lines()["old"]
assert (
old["over"] == 3 and old["violations"] == "" and old["ground"] == "" and old["ends"] == ""
)
def test_창에_줄_두_개와_도움말() -> None:
rec = (B05 / "B05_Profile_UI_RouteEdit_Recommend.ts").read_text(encoding="utf-8")
assert '<div data-line="ground" hidden></div>' in rec
assert '<div class="is-warn" data-line="ends" hidden></div>' in rec
assert 'line("violations").title = (brokenItems(view?.metrics ?? null) ?? [])' in rec
assert "const ends = endsLine(view);" in rec
help_ts = (B05 / "B05_Profile_UI_RouteEdit_Recommend_Help.ts").read_text(encoding="utf-8")
for name in ('name: "원지반 기울기(참고)",', 'name: "시종점 높이 차",'):
assert name in help_ts
assert "이보다 가파른 구간을 만들지 않음" not in help_ts
assert "「기준 초과」 수와 같음" in help_ts