Files
Aislo/resources/tester/test_155_b09_tabs.py
T
eomsangdonandClaude Opus 5.5 00067310f1 feat(ui,B08,B09): 공용 표 level(보기 전용 들여쓰기) · mergeSame(같은 값 세로 병합) 옵션 · B08 · B09 표 적용 (201-1)
- 레벨: 설계내역서 · 총괄 · 원가계산서 · 일위대가표 · 단가산출근거 · 중기사용료 = 공용 표 level (옛 is-lvN · is-indent · is-flat · 앞 빈칸 들여쓰기 갈음)
- 병합: B08 토공집계표(구분 · 규격) · 콘크리트소요(구분) · 자재 총괄(구분) / B09 원가계산서(구분 · 비목) · 총괄(공종) · 기초자료(구분) · 단가산출근거(공종) · 연결 점검(탭)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SE9MxeXTu2uaDZ55BJowAY
2026-10-10 14:26:59 +09:00

107 lines
4.6 KiB
Python

"""155 B09 탭 화면 꼴 — 일위대가표 줄 꼴(155-2) · 단가산출근거 텍스트 수식 칸(155-5).
`B09_Estimation_UI_Tabs.ts` + `B09_Estimation_UI_Tabs_Labor.ts` 를 Node(타입 지움)로 돌려
견본 블록 하나(머리 · 품셈 인용 · 줄 둘 · 합계)의 표 줄 글 · 줄 꼴을 판정.
"""
import json
import re
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
IMPORTS = re.compile(r"^import[^;]*;\n", re.MULTILINE)
BLOCK = {
"id": "DG1",
"no": 1,
"name": "찰쌓기",
"spec": "",
"unit": "m2",
"kind": "품셈",
"cite": "건설표준품셈 7-1-2",
"lines": [
{"kind": "labor", "key": "L00005", "name": "석공", "qty": 0.072, "unit": "인",
"price": 258935, "amount": 18643.3, "ref_no": "노무3",
"prices": {"labor": 258935, "material": None, "expense": None},
"amounts": {"labor": 18643.3, "material": None, "expense": None}},
{"kind": "sangeun", "key": "SG1", "name": "뒷채움", "qty": 0.5, "unit": "m3",
"price": 8328, "amount": 4164, "ref_no": "산근 1호표",
"prices": {"labor": 6878, "material": 538, "expense": 912},
"amounts": {"labor": 3439, "material": 269, "expense": 456}},
],
"sum": 22807, "labor": 22082, "material": 269, "expense": 456,
} # fmt: skip
def _node(js_body, tab="UI_Tabs_Labor"):
src = "".join(
IMPORTS.sub("", (ROOT / "B09_Estimation" / f"B09_Estimation_{n}.ts").read_text("utf-8"))
for n in ("UI_Tabs", tab)
)
result = subprocess.run(
["node", "--experimental-strip-types", "--no-warnings",
"--input-type=module-typescript", "-e", src + js_body],
capture_output=True, text=True, encoding="utf-8", timeout=60,
) # fmt: skip
assert result.returncode == 0, result.stderr
return json.loads(result.stdout)
def test_155_2_일위대가표_제목_굵게_하위_ㄴ():
out = _node(
f"\nconst t = buildDaegaBlocks({{ sheets: {{ daega_blocks: [{json.dumps(BLOCK)}] }} }});"
"\nconsole.log(JSON.stringify({ names: t.rows.map((r) => r.name),"
" cls: t.rows.map((_, i) => t.rowClass(i) ?? null),"
" lv: [t.level.key, ...t.rows.map((_, i) => t.level.of(i))] }));"
)
assert out["names"] == [
"제 1 호표 찰쌓기",
"ㄴ 건설표준품셈 7-1-2",
"ㄴ 석공",
"ㄴ 뒷채움",
"합 계",
] # 201-1 들여쓰기 = 공용 표 level(앞 빈칸 없앰)
assert out["cls"] == ["is-title", None, None, None, "is-title"]
assert out["lv"] == ["name", 1, 2, 2, 2, 1]
SG = {
"key": "SG:A", "no": 1, "name": "뒷채움", "unit": "m3", "spec": "규격=150",
"head": ["뒷채움 / m3", "산림품셈 13-3-2 적용", "규격 : 150 mm"],
"lines": [
{"kind": "labor", "name": "보통인부", "ref": {"tab": "labor", "key": "LB2"}, "why": None,
"labor": 2979.8, "material": 0.0, "expense": 0.0,
"text": ["보통인부 : 165,545 * 0.018 = 2,979.8"]},
{"kind": "machine", "name": "굴착기", "ref": {"tab": "machine", "key": "EQ1"}, "why": None,
"labor": 3899.0, "material": 538.6, "expense": 912.8,
"text": ["굴착기 노무비 : 55,700 * 0.07 = 3,899.0", "굴착기 재료비 : 7,695 * 0.07 = 538.6",
"굴착기 경비 : 13,041 * 0.07 = 912.8"]},
],
"labor": 6878, "material": 538, "expense": 912, "sum": 8328, "why": None,
"foot": "계 : 노무비 6,878 + 재료비 538 + 경비 912 = 8,328",
} # fmt: skip
def test_155_5_단가산출근거_엑셀_꼴_칸():
out = _node(
f"\nconst t = buildSg({{ sheets: {{ sg: [{json.dumps(SG, ensure_ascii=False)}] }} }});"
"\nconsole.log(JSON.stringify({ rows: t.rows, cols: t.columns.map((c) => c.key),"
" cls: t.rows.map((_, i) => t.rowClass(i) ?? null) }));",
"UI_Tabs_Sangeun",
)
assert out["cols"] == ["kind", "text", "sum", "labor", "material", "expense", "note"]
rows = out["rows"]
assert [(r.get("kind"), r["text"]) for r in rows] == [
("제 1 호표", "뒷채움 / m3"),
(None, "산림품셈 13-3-2 적용"),
(None, "규격 : 150 mm"),
("노무", "보통인부 : 165,545 * 0.018 = 2,979.8"),
("중기", "굴착기 노무비 : 55,700 * 0.07 = 3,899.0"),
("중기", "굴착기 재료비 : 7,695 * 0.07 = 538.6"), # 201-1 같은 공종 = 세로 병합
("중기", "굴착기 경비 : 13,041 * 0.07 = 912.8"),
("총 계", "계 : 노무비 6,878 + 재료비 538 + 경비 912 = 8,328"),
]
assert [r.get("sum") for r in rows[3:7]] == [2979.8, 3899.0, 538.6, 912.8]
assert out["cls"] == ["is-title"] + [None] * 6 + ["is-title"]