Files
Aislo/resources/tester/test_472_4_follow_node.py
T
eomsangdonandClaude Opus 5.5 cca08daa11 refactor(472-4 ① 꼭짓점 세움): 서버 꼭짓점 세움도 TS seatBornNodes 한 벌 — Node 입구 profile.seat
- 새 design_calc_node_follow.ts(따라감 몫 runner) · 입구는 두 줄만(import · 펼침) · 등록부 runner node:profile.seat · 실행기 NODE_IDS
- Router_Confirm._seat_born_nodes = run_calc 겉(세울 자리 없으면 Node 안 부름) · 파이썬 셈 · 상수 걷음
- 시험 test_472_4_follow_node(옛 코드 빨강 2) · 427_1 · 459 거울 통과 · 472-3 NODE_IDS 에 profile.seat(cross.design 빨강은 ② 몫)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 09:33:23 +09:00

60 lines
2.1 KiB
Python

"""PLAN 472-4 ① — 측점 열쇠 · 시설 따라감 · 추가 측점 · 꼭짓점 세움을 서버도 같은 TS(Node 입구)로 셈.
파이썬 짝을 걷고 서버 부름 자리는 `common_util_calc_runner.run_calc`(등록부 id) 한 길 —
profile.seat `Router_Confirm._seat_born_nodes`(측점 병합 · 노선 저장 `_carry_profile`)
고정 자료 = `fixtures/golden_472/detail.json`(472-1 · 읽기만).
./venv/Scripts/python.exe -m pytest resources/tester/test_472_4_follow_node.py -q
"""
from __future__ import annotations
import json
import sys
from pathlib import Path
import pytest
HERE = Path(__file__).resolve().parent
ROOT = HERE.parents[1]
sys.path.insert(0, str(ROOT))
from B05_Profile import B05_Profile_Router_Confirm as confirm # noqa: E402
from common_util import common_util_calc_runner as runner # noqa: E402
pytestmark = pytest.mark.skipif(
not (ROOT / "config" / "node_modules" / "vite").is_dir(),
reason="프론트엔드 의존성 미설치",
)
DETAIL = json.loads((HERE / "fixtures" / "golden_472" / "detail.json").read_text(encoding="utf-8"))
@pytest.fixture
def calls(monkeypatch) -> list[list[str]]:
seen: list[list[str]] = []
def spy(ids, inputs):
seen.append(list(ids))
return runner.run_calc(ids, inputs)
monkeypatch.setattr(confirm, "run_calc", spy)
return seen
def test_꼭짓점_세움은_Node_입구(calls) -> None:
stored = DETAIL["longitudinal"]["profile_alignment"]
base = [node for node in stored["base_pvi"] if abs(node["chainage_m"] - 351.0) > 0.5]
got = confirm._seat_born_nodes(stored, base, [351.0])
assert calls == [["profile.seat"]]
assert len(got) == len(base) + 1
seated = next(node for node in got if abs(node["chainage_m"] - 351.0) < 1e-9)
old = next(node for node in stored["base_pvi"] if abs(node["chainage_m"] - 351.0) < 1e-9)
assert seated["elevation_m"] == pytest.approx(old["elevation_m"], abs=0.5)
def test_세울_자리_없으면_Node_안_부름(calls) -> None:
stored = DETAIL["longitudinal"]["profile_alignment"]
assert confirm._seat_born_nodes(stored, stored["base_pvi"], [351.0]) == stored["base_pvi"]
assert calls == []