Files
Aislo/resources/tester/test_74_route_confirm_initial.py
T
eomsangdonandClaude Opus 5.5 5569bb6750 fix(B05): 균형 종단 반영도 1차 종단과 같은 맞춤 — 종단곡선이 들어가도 측점마다 균형 계획고를 지남(74-4)
- 꼭짓점 반복 보정을 pass_through 로 떼어 1차 종단(목표 = 지반고) · 균형 종단 반영(목표 = 균형 종단)이 함께 씀
- 측점 계획고 대 균형 종단 차 최대 0.092 m 였던 것을 없앰
- 「종단 반영」 도움말 — 켬으로 [적용]한 노선 그대로 [확인]하면 균형 종단이 첫 계획선
- 토글 단추 — 두 줄 알약 오른쪽 가운데 · 켬 글자색 토큰 바로잡음

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYJJRCfHfdCGNhmXTjQKV7
2026-10-07 18:46:44 +09:00

75 lines
2.8 KiB
Python

"""노선 [확인] 체인 이월 · 균형 종단 반영(PLAN 74-3 · 74-4).
./venv/Scripts/python.exe -m pytest resources/tester/test_74_route_confirm_initial.py -q
"""
import json
from pathlib import Path
from B05_Profile.B05_Profile_Router_Replan import RouteReplanRequest
from B05_Profile.B05_Profile_Router_RouteInitial import _set_base_pvi
from B06_Section.B06_Section_Router_Design import CARRY_INPUT_KEYS
ROOT = Path(__file__).resolve().parents[2]
def test_이월은_사용자_입력만() -> None:
for result_key in (
"design_elevation_m",
"cut_area_m2",
"fill_area_m2",
"design_line",
"road_edges",
"slope_unclosed",
"section_mode",
"ditch_side",
):
assert result_key not in CARRY_INPUT_KEYS
assert {"ground_type", "paved", "ditch_choice", "cut_slope_ratio_user"} <= set(CARRY_INPUT_KEYS)
def test_체인이_옛_설계를_통째로_옮기지_않는다() -> None:
source = (ROOT / "B03_FileInput" / "B03_FileInput_Service_Chain.py").read_text(encoding="utf-8")
assert 'record["design"])' not in source # 옛 (누가거리, design 통째) 이월
assert "compute_default_designs, project_root, long_path, chainages, standard, inputs" in (
" ".join(source.split())
)
def test_변화점_계획고를_균형_종단으로(tmp_path: Path) -> None:
path = tmp_path / "longitudinal.json"
base = [{"chainage_m": s, "elevation_m": 100.0} for s in (0.0, 20.0, 30.0, 40.0)]
alignment = {"base_pvi": base, "policy": {}}
path.write_text(json.dumps({"profile_alignment": alignment}), encoding="utf-8")
assert _set_base_pvi(path, [0.0, 20.0, 40.0], [10.0, 12.0, 14.0]) == 4
got = [
p["elevation_m"]
for p in json.loads(path.read_text("utf-8"))["profile_alignment"]["base_pvi"]
]
assert got == [10.0, 12.0, 13.0, 14.0] # 구조물 측점(30 m)은 직선 보간
def test_확인_요청_기본은_끔() -> None:
assert RouteReplanRequest().balanced_profile is False
assert RouteReplanRequest(balanced_profile=True).balanced_profile is True
def test_종단곡선이_있어도_측점마다_목표를_지난다() -> None:
import numpy as np
from B05_Profile.B05_Profile_Engine_Grade_Alignment import (
AlignmentPolicy,
build_curves,
evaluate,
)
from B05_Profile.B05_Profile_Engine_Grade_Profile import pass_through
base_s = np.array([0.0, 20.0, 40.0, 60.0, 80.0])
target = np.array([100.0, 102.4, 102.0, 104.6, 103.0]) # 대수차가 커 곡선이 들어감
policy = AlignmentPolicy.from_dict({})
curves, _ = build_curves(base_s, target, policy)
assert curves # 맞춤이 없으면 측점에서 뜸
base_z = pass_through(base_s, target, policy)
got = evaluate(base_s, base_z, build_curves(base_s, base_z, policy)[0], base_s)
assert np.max(np.abs(got - target)) < 1e-3