Files
Aislo/resources/tester/test_458_swap_attach.py
T
eomsangdonandClaude Opus 5.5 37a738aff4 fix(458 B06 노선 바뀜): 주인 측점 거리 상한 0.51 m · 시종점 밖 시설 안 얹음 · 갈아끼움 grid 지움 · 늘 다시 얹기 · 이름 = 계획 제목
- 관 세트 주인 측점 = 0.51 m 안 가장 가까운 측점(TS attachCulvertSets ↔ 파이썬 attach_culvert_specs) · 넘으면 연동 이웃에도 안 얹고 missed
- 형상 얹기 한 벌(attachShapes ↔ attach_shapes) — 시종점 측점 자리인데 좌표가 노선 진행 반대쪽 0.51 m 넘게 바깥 = 「노선 밖」 · 안 얹음 · 안 얹은 것 돌려줌(서버 = 로그 경고)
- 측점 갈아끼움 — 격자 아닌 자리면 앞 횡단 grid 표시 지움 · 갈아끼움 뒤 가게 초안 없어도 늘 다시 얹음 · 카드 · 종단 측점 이름 = 계획 제목 · 안 얹은 시설 알림(바뀐 때 한 번)
- 시험: test_458_swap_attach(재현 A · D) · test_323_4 거울 moved 경우(상한 · 시종점 밖 · 연동 폭) · test_299 같은 키 견본 = 주인 0.51 m 안으로 · 273_2 흉내 돌려줌

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 22:44:41 +09:00

67 lines
2.4 KiB
Python

"""458 노선 바뀜 — B06 갈아끼움 + 지금 현황으로 다시 얹기 · 주인 측점 거리 상한 · 시종점 밖.
못박는 것
- 시점 당김(재현 A 꼴): 관 · 세월교 그림 = 제 측점 하나씩(따라간 누가거리) · 격자를 떠난 관 측점 `grid` 지움.
- 가게 초안 없는 채(저장분 현황) 얹어도 옛 자리 세월교가 이웃 일반 측점에 안 붙음(상한 0.51 m · 측점 없음).
- 시점 밖으로 밀린 관(재현 D 꼴) = 시점 측점에 안 얹고 「노선 밖」.
Node 헬퍼 `helper_458_swap_attach.cjs` 가 진짜 모듈(따라감 · 측점 · 갈아끼움 · 형상 얹기)을 부름.
"""
import json
import subprocess
from pathlib import Path
import pytest
HERE = Path(__file__).resolve().parent
ROOT = HERE.parents[1]
pytestmark = pytest.mark.skipif(
not (ROOT / "config" / "node_modules").is_dir(), reason="프론트엔드 의존성 미설치"
)
@pytest.fixture(scope="module")
def out() -> dict:
proc = subprocess.run(
["node", str(HERE / "helper_458_swap_attach.cjs")],
cwd=ROOT,
capture_output=True,
text=True,
encoding="utf-8",
timeout=120,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def _shaped(sections: list[dict]) -> dict[float, dict]:
return {s["chainage_m"]: s["shapes"] for s in sections if s["shapes"]}
def test_시설마다_제_측점_하나(out):
shift = out["shift"]
assert shift["pipes"] == [["p1", 47], ["p2", 157]]
assert _shaped(shift["now"]) == {47: {"culvert": 47}, 157: {"ford": 157}}
assert shift["misses"] == {"outside": [], "far": []}
def test_격자_떠난_시설_측점_grid_지움(out):
by_at = {s["chainage_m"]: s for s in out["shift"]["now"]}
assert by_at[47]["kind"] == "irregular" and by_at[47]["grid"] is False
def test_저장분_현황이어도_이웃에_안_붙음(out):
shift = out["shift"]
assert shift["staleMisses"]["far"] == [150]
assert all("ford" not in shapes for shapes in _shaped(shift["stale"]).values())
def test_시점_밖_관은_안_얹고_노선_밖(out):
outside = out["outside"]
assert ["p1", 0] in outside["pipes"]
assert outside["misses"] == {"outside": [0], "far": []}
assert _shaped(outside["now"]) == {100: {"ford": 100}}
assert {s["chainage_m"]: s["grid"] for s in outside["now"]}[20] is True # 격자 자리 옹벽 측점