Files
Aislo/resources/tester/test_b09_unread_tables.py

57 lines
2.7 KiB
Python

"""사유 없이 버려지는 표 — 2026-09-15 브레인 차례 ① (㉯ 가르기에서 6 · 전체로 재면 49).
일할 표(작업량·소요량·형식 미정)를 가진 잎 공종인데 **제목도 사유도 없는** 것 — 표를 읽는 길이 없어
한 줄도 안 서고 `unattached`·`component_gaps`·밑수·[주] 사유 어디에도 안 남아, 내역서엔 「일위대가가 아직
없습니다」 만 뜸(무엇을 손볼지 모름). 예: 3-1 경계표시 F0075 「0.2 | 보통인부」(값이 이름 앞) ·
6-4-1 덩굴걷기 F0158 · 7-3 아키야윈치 F0174 · 10-13-1 드론운반 F0322(형식 미정).
⇒ 읽는 길을 만드는 것은 뒤(예취기 한 모양 4 …) — 여기서는 **버린 표를 사유로 남김**(버릴 때는 사유).
"""
from __future__ import annotations
from B09_Estimation.B09_Estimation_KnownGaps import known_gap_note
from B09_Estimation.B09_Estimation_ResourceAxis import load_work_item_master
from B09_Estimation.B09_Estimation_UnitPrice import cached_build
WORK_FORMS = {"productivity", "requirement", "undetermined"}
def test_제목_없는_잎_공종은_모두_사유가_있음() -> None:
build = cached_build()
master = load_work_item_master()
parents = {n.get("parent_code") for n in master["work_items"]}
titled = {t[2:].split("#")[0] for t in build.book.titles if t.startswith("B-")}
silent = [
n["work_item_code"]
for n in master["work_items"]
if n["work_item_code"] not in titled
and n["work_item_code"] not in parents
and any(t.get("pum_form") in WORK_FORMS for t in n.get("tables") or [])
and not (
build.unattached.get(n["work_item_code"])
or build.component_gaps.get(n["work_item_code"])
or n["work_item_code"] in build.basis_missing
or known_gap_note(n["work_item_code"])
)
]
assert silent == [], silent
def test_사유는_표_번호와_모양을_가리킴() -> None:
gaps = cached_build().component_gaps
# 6-4-1 덩굴걷기 F0158 은 예취기 도구 줄 표로 풀려 사유가 저절로 빠짐 → 6-2-1 둘레베기로 갈음
for code, table in (
("FP-03-01", "F0075"),
("FP-06-02-01", "F0154"),
("FP-07-03", "F0174"),
("FP-03-08", "F0082"),
):
assert table in gaps[code] and "한 줄도" in gaps[code], (code, gaps.get(code))
assert "F0322" in gaps["FP-10-13-01"] and "형식 미정" in gaps["FP-10-13-01"]
def test_부모와_제목_선_공종에는_안_붙음() -> None:
build = cached_build()
assert "FP-04-01" not in build.component_gaps # choose_one 부모 — 잎이 섬
assert "FP-05-24-01" not in build.component_gaps # 제목 선 공종