Files
Aislo/resources/tester/test_457_draft_card.py
T
eomsangdonandClaude Opus 5.5 4a749584e6 fix(457 노선 바뀜 초안 카드): 그림 · 이름 · 횡단 맥락 = 지금 현황을 새 측점에 다시 얹음 · 등록 열쇠 짝 · 가게 쓰기 = 지금 가게 값과 견줌
- 초안 상세(카드)도 캐시와 같은 attachShapes 를 follow 뒤 현황으로 부름 · atChainage 지움 · 이름 = 측점 계획 제목
- cross 입력 넘김 = 사용자 칸 · 카드 번호만 · 포장 · 기울임 · 하강 = 새 자리 그림에서(crossWithShapes · 점 창도)
- 초안 자리 시설 측점 짝 = 등록 열쇠(B06 측점 열쇠 목록 · 처음 본 열쇠) · 차례 짝 지움
- writeFacilities = 지금 가게 값과 견줌(되돌리기 뒤 같은 조작도 씀)
- 시험 test_457_draft_card(재현 E · F · G · H) · 365 · 433 · 440 도우미 새 규칙으로

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

96 lines
3.9 KiB
Python

"""457 노선 바뀜 — 초안 카드 그림 · 이름 · 횡단 맥락 = 지금 현황을 새 측점에 다시 얹음(요구 270).
재현 E · F(시점 당김 +13 · +7 — 배관 · 물넘이포장 · 옹벽) · G(세션에서 놓은 BOX) ·
H(관 둘 엇갈려 옮김 · 초안 둔 채 열기).
① 모든 측점 카드 그림 · 이름 = 새 측점에 따라간 관 · 구조물을 얹은 것(캐시 `withDraftShapes` 한 벌)
② 시설마다 제 측점 하나 · 옛 측점 그림을 옮기지 않음 · 카드 번호만 열쇠로 이어 받음
③ 시설 맥락(포장 · 기울임 · 하강) = 다시 얹은 그림에서 · 짝 = 등록 열쇠(차례 짝 없음 · 엇갈림 0)
④ 가게 쓰기 = 지금 가게 값과 견줌(되돌리기 뒤 같은 조작도 씀)
TS 셈은 `helper_457_draft_card.cjs`.
./venv/Scripts/python.exe -m pytest resources/tester/test_457_draft_card.py -q
"""
import json
import subprocess
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[2]
HELPER = Path(__file__).with_name("helper_457_draft_card.cjs")
pytestmark = pytest.mark.skipif(
not (ROOT / "config" / "node_modules" / "typescript").is_dir(),
reason="프론트엔드 의존성 미설치",
)
@pytest.fixture(scope="module")
def got() -> dict:
run = subprocess.run( # noqa: S603 — 고정 실행 파일
["node", str(HELPER)],
capture_output=True,
text=True,
encoding="utf-8",
timeout=120,
)
assert run.returncode == 0, run.stderr
return json.loads(run.stdout)
def _row(rows: list, key: str) -> dict:
return next(r for r in rows if r["key"] == key)
@pytest.mark.parametrize("name", ["E", "F", "G", "H"])
def test_카드_그림_이름이_새_자리_현황(got, name) -> None:
rows = got[name]["rows"]
bad = [(r["key"], r["card"], r["truth"]) for r in rows if r["card"] != r["truth"]]
assert not bad
names = [(r["key"], r["name"], r["truthName"]) for r in rows if r["name"] != r["truthName"]]
assert not names
@pytest.mark.parametrize("name", ["E", "F", "G", "H"])
def test_카드_번호만_이어_받음(got, name) -> None:
assert got[name]["specFields"] == ["station_id"]
def test_E_물넘이포장은_제_측점에만(got) -> None:
rows = got["E"]["rows"]
fp = _row(rows, "pipe:fp")
assert "ford_pavement@" in fp["card"]
assert fp["ctx"][:2] == [True, True] # 포장 · 기울임 = 새 자리 그림
no6 = _row(rows, "grid:6") # 120 m — 옛 물넘이 범위(119~131) · 새 범위(132~144) 밖
assert "ford_pavement" not in no6["card"] and no6["name"] is None
assert no6["ctx"] == [False, False, None, 0]
pipes = [r for r in rows if "culvert@" in r["card"]]
assert [r["key"] for r in pipes] == ["pipe:p1"] # 배관 그림 = 관 측점 하나(No.3 아님)
def test_G_세션에서_놓은_BOX_카드(got) -> None:
box = _row(got["G"]["rows"], "pipe:p9")
assert "box@" in box["card"] and box["name"]
def test_H_엇갈려_옮긴_관_짝(got) -> None:
h = got["H"]
p1 = _row(h["rows"], "pipe:p1")
p2 = _row(h["rows"], "pipe:p2")
assert "culvert@" in p1["card"] and "box@" not in p1["card"]
assert "box@" in p2["card"] and "culvert@" not in p2["card"]
# 카드 번호 = 같은 관의 화면 상세 번호(등록 열쇠 짝 · 목록이 바뀌어도 처음 본 열쇠)
assert h["sourceKeys"]["pipe:p1"] == h["canonIds"]["pipe:p1"]
assert h["sourceKeys"]["pipe:p2"] == h["canonIds"]["pipe:p2"]
assert p1["id"] == h["canonIds"]["pipe:p1"]
def test_가게_쓰기는_지금_가게_값과_견줌() -> None:
page = (ROOT / "A00_Common" / "design" / "design_pipeline_page.ts").read_text(encoding="utf-8")
body = page[page.index("function writeFacilities") :]
body = body[: body.index("\n }\n")]
assert 'same(store.get("pipes"), next.pipes)' in body
assert 'same(store.get("structures"), next.structures)' in body
assert "written" not in page