Files
Aislo/resources/tester/test_52_1b_pipe_links.py
T
eomsangdonandClaude Opus 5.5 7e6d3fa500 feat(M02): 배관 선택 컨테이너마다 집계표 한 줄 (PLAN 52-1b)
- 흙막이 추가 · 도수로/돌붙임 인스턴스마다 한 건 — 잇기 group_items[{link}{n}] 항목 · 그 컨테이너 값(형태 · 길이 · 높이 · 전 · 후를 열이 읽는 칸에 얹음) · 복사본 pipe@측점__{link}{n}
- 옛 값 — 컨테이너 없는 옛 관 · 인스턴스 없는 잇기는 줄 없음
- 서버 컨테이너 표 = 배관 명세 TS 짝(시험이 대조) · 700줄 한계로 M02_Table_Fill_Spec 따로
- 시험 test_52_1b_pipe_links · 52-1 화면 시나리오에 집계표 줄 수

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVPp2o6Mh2FZJr72yW3ofZ
2026-10-05 23:51:11 +09:00

85 lines
3.4 KiB
Python

# -*- coding: utf-8 -*-
"""배관 남은 연동 — PLAN 52-1b.
못박는 것
- 집계표: 선택 컨테이너(흙막이 추가 · 도수로/돌붙임)마다 한 건 — 잇기 `{link}{n}` 항목 ·
그 컨테이너 값.
- 짝: 서버 컨테이너 표(머리 · 잇기) = 배관 명세 TS.
"""
from __future__ import annotations
import json
import os
import re
from M02_MasterTemplete import M02_Table_Fill as fill
from M02_MasterTemplete.M02_Table_Fill_Spec import SPEC_CONTAINERS, container_rows
from resources.tester.test_structures_summary_snapshot import ( # noqa: F401 — world 고정물
MS,
PIPE,
RV,
_pipe,
_save,
world,
)
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(os.path.dirname(HERE))
SOIL = {
"soil_add_1_structure": "기슭막이",
"soil_add_1_form": "바자",
"soil_add_1_length": 6,
"soil_add_1_height": 2,
"soil_add_2_structure": "기슭막이",
"chute_add_1_structure": "돌붙임",
}
def test_컨테이너마다_한_건_잇기와_그_값():
item = {"type_id": "pipe", "options": {"pipe_diameter_mm": 1000, **SOIL}, "복사본": "pipe@40.0"}
rows = container_rows(item, {"gsoiladd1": RV, "gchuteadd1": MS})
assert [r["그룹"] for r in rows] == ["흙막이 추가 1", "흙막이 추가 2", "도수로/돌붙임 1"]
assert [r["복사본"] for r in rows] == [
"pipe@40.0__gsoiladd1",
"pipe@40.0__gsoiladd2",
"pipe@40.0__gchuteadd1",
]
assert [r["summary_item"] for r in rows] == [RV, None, MS]
first = rows[0]["options"]
assert first["length_m"] == first["inlet_revet_length_m"] == first["outlet_revet_length_m"] == 6
assert (
first["form"] == first["outlet_revet_form"] == "바자" and first["outlet_type"] == "기슭막이"
)
assert first["pipe_diameter_mm"] == 1000 # 구조물 옵션은 그대로
assert container_rows({"type_id": "masonry_dry", "options": SOIL, "복사본": "st0"}, {}) == []
# 옛 값 — 컨테이너 없는 옛 관 · 인스턴스 없는 잇기는 줄 없음
old = {"type_id": "pipe", "options": {"inlet_revet_length_m": 5}, "복사본": "pipe@9.0"}
assert container_rows(old, {"gsoiladd9": RV}) == []
def test_집계표_채움에_컨테이너_줄(world):
"""흙막이 추가 1 → 돌기슭막이 열(rv) 6 m · 관 본체 · 미지정 컨테이너는 표에 안 듦."""
root, system = world["root"], world["system"]
point = {**_pipe(PIPE), "group_items": {"gsoiladd1": RV}}
point["options"] = {**point["options"], **SOIL}
_save(root, [], [point])
table = json.loads((system / "table/구조물집계표.json").read_text("utf-8"))
doc = fill.fill_table(root, table)
values = [row["값"] for row in doc["줄"] if not row.get("고정")]
rv = [v for row in values for k, v in row.items() if k.split("|")[0] == "rv"]
assert rv == [6]
copies = [i["복사본"] for i in fill.collect_items(root)]
assert "pipe@40.0__gsoiladd1" in copies and "pipe@40.0__gchuteadd1" in copies
def test_서버_컨테이너_표는_배관_명세와_짝():
with open(
os.path.join(ROOT, "A00_Common/design/design_structure_pipe.ts"), encoding="utf-8"
) as f:
text = f.read()
found = re.findall(
r'title: "([^"]+)",\s*required: false,\s*prefix: "(\w+)",\s*link: "(\w+)"', text
)
assert [(p, link, t) for t, p, link in found] == list(SPEC_CONTAINERS["pipe"])