Files
Aislo/resources/tester/test_work_item_master_variants.py
T
eomsangdonandClaude Opus 5 5e76850d3b feat(axis): 마스터 갈래 키를 표 모양대로 — 단가표 갈래 제목 294 중 294 가 키에 있음(종전 86)
종전 variant_key 는 표 첫 열 값 24개라 머리행 갈래·두 단 머리를 놓치고 첫 열이 자원 이름인 표를 갈래로 적었음.
표 모양 가르기는 B09 표 읽기에 이미 있어 두 벌을 안 짜고, 그 읽기를 메모리의 마스터에 돌려 표마다 가른 갈래를 원문 표기로 실음.
못 가른 표는 빈칸. 공종마다 variant_keys(불도저 공식 갈래·합산형 단계 암질·[주]① 평균 · 부모는 단계 갈래).
짝 시험 — 단가표 #갈래 제목이 전부 마스터 키에 있어야 함.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BW6Jdsh18WPtYUR6THZJqn
2026-09-13 23:11:42 +09:00

50 lines
2.2 KiB
Python

"""공종 마스터 갈래 키 `variant_key` — 표 읽기가 가른 대로 (명세 14장 정정 · 2026-09-13).
지키는 것
① 짝 시험 — 단가표의 `B-<코드>#<갈래>` 제목은 **전부** 그 공종의 마스터 갈래 키에 있다
(종전 첫 열 24개 방식은 294 중 86). 표 읽기를 고치고 마스터를 안 다시 뽑으면 여기서 걸림
② 머리행 갈래(벌목)·뭉친 이름 표(찰쌓기 장비)는 머리행에서 · 첫 열이 자원 이름인 표는 빈칸
③ 합산형 부모는 단계 갈래를 물려받음(흙깎기 리핑암 9-4 = 암질 + [주]① 평균)
"""
from __future__ import annotations
from B09_Estimation.B09_Estimation_ResourceAxis import load_work_item_master
from B09_Estimation.B09_Estimation_UnitPrice import cached_build, normalize_variant_key
def _nodes() -> dict[str, dict]:
return {node["work_item_code"]: node for node in load_work_item_master()["work_items"]}
def test_단가표_갈래_제목은_전부_마스터_갈래_키에_있다() -> None:
nodes = _nodes()
missing = []
for code in cached_build().book.titles:
if not code.startswith("B-") or "#" not in code:
continue
work_item, variant = code[2:].split("#", 1)
keys = {
normalize_variant_key(k) for k in nodes.get(work_item, {}).get("variant_keys") or []
}
if variant not in keys:
missing.append(code)
assert not missing, f"마스터를 다시 뽑을 것(B08_Quantity_Build_WorkItemMaster): {missing[:5]}"
def test_표_모양대로_갈래를_가르고_못_가르면_빈칸() -> None:
nodes = _nodes()
felling = nodes["FP-04-02-02"]["tables"][0]["variant_key"]
assert "5m이상~8m미만" in felling # 머리행 갈래 — 첫 열(자원 이름)이 아님
assert nodes["FP-13-04-05"]["tables"][0]["variant_key"] == [
"35cm 이하",
"55cm 이하",
"75cm 이하",
]
finishing = next(t for t in nodes["FP-12-02"]["tables"] if t["pum_table_id"] == "F0334")
assert finishing["variant_key"] == [] # 첫 열이 자원 이름(미장공)인 표
def test_합산형_부모는_단계_갈래를_물려받는다() -> None:
assert _nodes()["FP-09-04"]["variant_keys"] == ["연암", "보통암", "경암", "평균"]