Files
Aislo/resources/tester/test_167_1_b08_pipe_owner_id.py
T
eomsangdonandClaude Opus 5.5 5e25f418cc refactor(b08): 탭 표 자료 읽기 · 표 짜기를 화면 없는 파일로 꺼냄 — 구조물 집계표 · 자재 · 토공 · 수리 입력 · 거리이정표 · 화면은 같은 함수를 씀 · 동작 그대로 (302-3)
- 새 파일 = B08_Quantity_Summary_Table · Material_Tables · Earthwork_Tables · Hydro_Table · Milestone_Table
- 화면 UI 파일 = 불러오기 · 그리기만 · 옛 B08 시험 = 옮긴 글 자리 따라 읽는 파일 더함

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Se7ytqbohmBQnfYpwYFnYf
2026-10-13 08:03:23 +09:00

59 lines
2.5 KiB
Python

# -*- coding: utf-8 -*-
"""167-1 B08 구조물도 모달 — 일부 칸만 연결된 관 지점도 조합 카드가 뜸.
까닭 = 관 지점 응답 측점은 소수 둘째 자리(B04 `round(…, 2)` · 80.17) · 사본 id 는 셋째 자리
(`pipe@80.167`) → 화면이 만든 id 가 사본과 어긋나 `linkedOnly` 가 빼고 `combosAt` 이 빈 배열.
고침 = 서버가 낸 id(사본 · 시설) 가운데 같은 측점(±6mm)의 것을 씀(`pipeOwnerId`).
`B08_Quantity_Summary_Data.ts` 를 node 로 돌림(61-1 시험과 같은 꼴).
"""
import json
from pathlib import Path
from test_61_1_b08_summary_table import _item, _run
ROOT = Path(__file__).resolve().parents[2]
# 검증_랩탑메인 재현 꼴 — 배관 네 칸 가운데 본체만 연결
LINKED = {
"pipe@80.167": {
"항목": _item("SS55"),
"폴더": "pipe@80.167",
"부분": ["도면"],
"경로": ["기슭막이"],
}
}
FACILITY_IDS = ["pipe@80.167", "pipe@173.09", "st1"]
POINT = {"chainage_m": 80.17, "summary_item": _item("SS55")} # 응답 = 둘째 자리
def test_서버_id_를_씀():
out = _run(
f"\nconst ids = {json.dumps(list(LINKED) + FACILITY_IDS)};"
"\nconsole.log(JSON.stringify({"
" a: pipeOwnerId(80.17, ids), b: pipeOwnerId(173.09, ['pipe@173.09__gford']),"
" c: pipeOwnerId(258.12, ids), d: pipeOwnerId(80.16, ['st1', 'pipe@80.165']) }));"
)
assert out == {"a": "pipe@80.167", "b": "pipe@173.09", "c": None, "d": "pipe@80.165"}
def test_한_칸만_연결_때_조합_하나():
out = _run(
f"\nconst linked = {json.dumps(LINKED, ensure_ascii=False)};"
f"\nconst p = {json.dumps(POINT, ensure_ascii=False)};"
"\nconst old = linkedOnly([{ ...p, structure_id: 'pipe@80.17' }], linked);"
"\nconst got = linkedOnly([{ ...p, structure_id: pipeOwnerId(p.chainage_m, Object.keys(linked)) }], linked);"
"\nconsole.log(JSON.stringify({ old: combosAt(old, 80.167).length, got: combosAt(got, 80.167) }));"
)
assert out["old"] == 0 # 고치기 전 = 카드 없음
assert len(out["got"]) == 1
assert out["got"][0]["copyId"] == "pipe@80.167" and out["got"][0]["id"] == "system||SS55"
def test_화면_연결():
summary = (ROOT / "B08_Quantity/B08_Quantity_UI_Summary.ts").read_text(encoding="utf-8") + (
ROOT / "B08_Quantity/B08_Quantity_Summary_Table.ts"
).read_text(encoding="utf-8")
assert "...(saved?.facilities ?? []).map((f) => f.id)" in summary
assert "pipeOwnerId(point.chainage_m, ids) ?? pipeStructureId(point.chainage_m)" in summary