Files
Aislo/resources/tester/test_b08_formwork_reuse_link.py
T

46 lines
2.4 KiB
Python

"""거푸집 사용횟수 → 12-4 갈래 잇기 · 집수정 4회 — 2026-09-14 브레인 ㉯ ①②.
① 옹벽 조립 조각 「FP-12-04 합판거푸집」 에 꼬리가 없어 12-4 사용횟수 갈래(#1~6회)를 못 고름 →
B08 이 성분에 단 사용횟수(`reuse_count`, 품셈 1-7-1 옹벽 3회)를 꼬리로 붙임(값은 한 벌).
② 집수정은 **12-15 표가 직접 적은 「거푸집 합판4회」 가 정본** — 1-7-1 분류로 본 6회는 걷음.
화면(자재 표 · 인계)과 표가 같은 값이어야 함(한 벌이 두 값으로 갈리지 않게).
"""
from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from B08_Quantity.B08_Quantity_Engine_Formwork import FORMWORK_NAMES # noqa: E402
from B08_Quantity.B08_Quantity_Engine_Handoff import build_handoff # noqa: E402
from B08_Quantity.B08_Quantity_Engine_UnitQuantity import build_table # noqa: E402
WALL = {"structure_id": "w1", "type_id": "retaining_wall", "start_m": 100.0, "end_m": 110.0,
"options": {"form": "반중력식", "height_m": 2.0, "length_m": 10.0}} # fmt: skip
BASIN = {"structure_id": "b1", "type_id": "pipe_inlet_basin", "start_m": 50.0, "end_m": 50.0,
"options": {"inlet_basin_form": "□형(기본형)", "inlet_basin_material": "콘크리트",
"pipe_diameter_mm": "800"}} # fmt: skip
def test_옹벽_조각_합판거푸집이_사용횟수_갈래로_이어져_단가가_섬() -> None:
from B09_Estimation.B09_Estimation_UnitPrice import cached_build
unit = build_table([WALL], {"retaining_wall": "옹벽"})
row = next(
r for r in build_handoff(unit_quantity_table=unit)["work_items"] if r["composite_parts"]
)
part = next(p for p in row["composite_parts"] if str(p["code"]).startswith("FP-12-04"))
assert part["code"] == "FP-12-04#3회" and not part.get("not_ready"), part
assert "B-FP-12-04#3회" in cached_build().book.titles
def test_집수정_거푸집은_12_15_표의_4회_화면과_인계가_같은_값() -> None:
unit = build_table([BASIN], {"pipe_inlet_basin": "집수정"})
forms = [c for s in unit["structures"] for c in s["components"] if c["name"] in FORMWORK_NAMES]
assert forms and all(c["reuse_count"] == 4 for c in forms), forms
assert all("12-15" in c["reuse_note"] for c in forms), forms