# -*- coding: utf-8 -*- """342-2 자동 체인 재계산 한 번 · 3D 는 [저장]·[확정] 끝. ③ 자동 체인은 서버 재계산 · 3D 짓기를 따로 부르지 않음 — [확정](confirm_sections) 끝 한 번씩 · 재계산 → 짓기 차례 · [저장](save_sections)도 끝에 짓기. (①② 노선 [확인] 체인 `run_redesign_chain` 시험 셋은 그 함수를 걷어(765-3 · 부르는 곳 0) 함께 지움.) """ from __future__ import annotations import re import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[2] if str(ROOT) not in sys.path: sys.path.insert(0, str(ROOT)) def _body(source: str, name: str) -> str: start = source.index(f"async def {name}(") following = re.search(r"\n(async def|def|@router)", source[start + 10 :]) return source[start : start + 10 + following.start()] if following else source[start:] def test_자동_체인은_재계산_짓기를_따로_안_부름(): source = (ROOT / "B03_FileInput" / "B03_FileInput_Service_Chain.py").read_text("utf-8") auto = _body(source, "run_auto_design_chain") assert "recompute_server_side" not in auto assert "prebuild_corridor" not in auto assert "confirm_sections(" in auto def test_확정_저장_끝에서_재계산_뒤_짓기(): source = (ROOT / "B06_Section" / "B06_Section_Router_Confirm.py").read_text("utf-8") for name in ("confirm_sections", "save_sections"): body = _body(source, name) assert body.count("_recompute_stored_designs(") == 1, name assert body.count("_prebuild_corridor(") == 1, name assert body.index("_recompute_stored_designs(") < body.index("_prebuild_corridor("), name confirm = _body(source, "confirm_sections") # 측구 방향 역반영(종단 파일 고침)까지 끝난 뒤 짓기 assert confirm.index("_merge_uphill_overrides_into_longitudinal") < confirm.index( "_prebuild_corridor(" ) def test_브라우저는_3D_를_올리지_않음(): source = (ROOT / "B05_Profile" / "B05_Profile_UI_Corridor.ts").read_text("utf-8") assert '"PUT"' not in source assert "putStored" not in source