- pipeStationMarks · pipe_station_label 물넘이포장 예외 걷음 · 라벨 「물넘이포장」 - B05 withoutFordPavement · B06 pipeStations · 초안 라벨 거름 걷음 · 알약 = 그 측점선 짝 - 시험 test_286_1 새로 · 272_1 · 284_1 · 옛 물넘이 측점 시험 기대값 새 규칙으로 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TteK8mfYZetk5P3bEZkyVZ
85 lines
2.9 KiB
Python
85 lines
2.9 KiB
Python
"""286 물넘이포장 종횡단 설계(요구 180-2).
|
|
|
|
못박는 것
|
|
- 286-1 물넘이포장도 기준 측점 하나 — TS `pipeStationMarks` · `plantedChainages` ↔ 서버
|
|
`resolve_extra_stations` 같은 값 · 라벨 「물넘이포장」 · B05 · B06 거름 걷음.
|
|
|
|
진짜 TS 는 `helper_286_1_ford_pavement.cjs` 가 Node 로 돌림. 화면은 사용자 확인.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
ROOT = HERE.parents[1]
|
|
if str(ROOT) not in sys.path:
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from B05_Profile.B05_Profile_Engine_Sections import resolve_extra_stations # noqa: E402
|
|
from B05_Profile.B05_Profile_Structures_Schema import structure_type_map # noqa: E402
|
|
from common_util.common_util_drainage_pipes import parse_pipe_points # noqa: E402
|
|
|
|
PIPES = [
|
|
{"chainage_m": 95.0, "source": "user"},
|
|
{"chainage_m": 230.0, "source": "user", "facility": "ford_pavement"},
|
|
{"chainage_m": 300.0, "source": "user", "facility": "ford_bridge"},
|
|
]
|
|
|
|
pytestmark = pytest.mark.skipif(
|
|
not (ROOT / "config" / "node_modules" / "typescript").is_dir(),
|
|
reason="프론트엔드 의존성 미설치",
|
|
)
|
|
|
|
|
|
def _read(*parts: str) -> str:
|
|
return (ROOT.joinpath(*parts)).read_text(encoding="utf-8")
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def ts(tmp_path_factory) -> dict:
|
|
types = [
|
|
{
|
|
"type_id": item.type_id,
|
|
"group": item.group,
|
|
"placement": item.placement,
|
|
"managed_by": item.managed_by,
|
|
}
|
|
for item in structure_type_map().values()
|
|
]
|
|
source = tmp_path_factory.mktemp("s286") / "in.json"
|
|
source.write_text(
|
|
json.dumps({"pipes": PIPES, "structures": [], "types": types}), encoding="utf-8"
|
|
)
|
|
proc = subprocess.run(
|
|
["node", str(HERE / "helper_286_1_ford_pavement.cjs"), str(source)],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_물넘이포장_측점_TS_파이썬_같은_값(ts, tmp_path):
|
|
assert ts["fordMarks"] == [{"chainage_m": 230, "role": "anchor"}]
|
|
server = resolve_extra_stations(tmp_path, parse_pipe_points(PIPES))
|
|
assert [mark for mark, _label in server] == ts["planted"] == [95, 230, 300]
|
|
assert dict(server)[230.0] == "물넘이포장"
|
|
|
|
|
|
def test_B05_B06_물넘이_거름_걷음():
|
|
page = _read("B05_Profile", "B05_Profile_UI_Page_Structures.ts")
|
|
assert "withoutFordPavement" not in page
|
|
assert "FACILITY_NAMES.ford_pavement" not in page
|
|
view = _read("B06_Section", "B06_Section_UI_Section_View_Profile.ts")
|
|
assert '"ford_pavement"' not in view
|
|
drafts = _read("B06_Section", "B06_Section_Section_Drafts.ts")
|
|
assert 'if (facility === "ford_pavement") return null;' not in drafts
|