Files
Aislo/resources/tester/test_b08_borrow_row.py
eomsangdonandClaude Opus 5 05d542add3 feat(b08): 토취(반입토) 줄 — 유토곡선이 낸 성토 부족분을 수량만 세우고 금액은 사유(브레인 ①)
- B06 운반계획의 borrow_m3·구간(residuals)을 운반표에 싣고 토공집계에 「토취(반입토)」 줄 · 인계는 코드 없이 수량만 · 막힘 사유 「토취장 거리·재료 미정」(집계 비고 그대로) · 다짐상태 그대로(반입 재료를 몰라 되돌리지 않음)
- 종전엔 어느 탭·인계에도 안 옮겨 수량이 통째로 빠졌음
- 936be972: 토공집계 7,259.84㎥(246.54~529.33m 3,494.69 · 720~1,078.01m 3,765.15) · 내역 「금액을 못 세운 줄」 · 본체 금액 변화 0

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016VBGFXB9AbJBwXP19z75Qq
2026-09-14 21:38:53 +09:00

65 lines
2.8 KiB
Python

"""토취(반입토) 줄 — 2026-09-14 브레인 ① 승인(수량만 · 금액은 사유).
B06 유토곡선이 성토 부족분을 토취로 냄(936be972 `haul_plan.borrow_m3` 7,259.84㎥ · 두 구간)인데 B08 이 어느 탭·인계에도
안 옮겨 수량이 통째로 빠졌음. ⇒ 운반표에 싣고 · 토공집계에 줄 · 인계에 막힌 줄(「토취장 거리·재료 미정」).
⚠ 수량은 유토곡선이 쌓은 **다짐상태** 그대로 — 반입 재료를 몰라 자연상태로 되돌릴 계수가 없음(지어내지 않음).
"""
from __future__ import annotations
import sys
from pathlib import Path
import pytest
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_EarthworkSummary import ( # noqa: E402
BORROW_NAME,
SummaryInput,
build_rows,
)
from B08_Quantity.B08_Quantity_Engine_Handoff import build_handoff # noqa: E402
from B08_Quantity.B08_Quantity_Engine_HaulSummary import borrow_of # noqa: E402
PLAN = {
"borrow_m3": 7259.84,
"residuals": [
{"kind": "borrow", "volume_m3": 3494.69, "from_m": 246.54, "to_m": 529.33},
{"kind": "borrow", "volume_m3": 3765.15, "from_m": 720, "to_m": 1078.01},
{"kind": "spoil", "volume_m3": 4.57, "from_m": 205, "to_m": 205},
],
}
def test_운반계획의_토취를_구간과_함께_싣는다() -> None:
borrow = borrow_of(PLAN)
assert borrow["volume_m3"] == pytest.approx(7259.84) and borrow["volume_basis"] == "compacted"
assert [s["volume_m3"] for s in borrow["sites"]] == [3494.69, 3765.15]
assert borrow_of({"borrow_m3": 0}) is None and borrow_of(None) is None
def test_토공집계에_수량만_선다() -> None:
rows = [r for r in build_rows(SummaryInput(borrow_m3=7259.84)) if r.group == BORROW_NAME]
assert len(rows) == 1 and rows[0].amount == pytest.approx(7259.84)
assert rows[0].in_bill is False and "토취장 거리·재료 미정" in rows[0].note
def test_인계는_막힌_줄_하나_금액_없음() -> None:
from B08_Quantity.B08_Quantity_Engine_EarthworkSummary import build_table
borrow = borrow_of(PLAN)
summary = build_table(SummaryInput(borrow_m3=borrow["volume_m3"], borrow_sites=borrow["sites"]))
handoff = build_handoff(summary_table=summary, haul_table={"rows": [], "borrow": borrow})
rows = [r for r in handoff["work_items"] if r["name"] == BORROW_NAME]
assert len(rows) == 1, rows # 한 줄만
row = rows[0]
assert row["quantity"] == pytest.approx(7259.84) and row["in_bill"] is False
assert (
row["blocked_kind"] == "input_missing" and "토취장 거리·재료 미정" in row["blocked_reason"]
)
assert "246.54~529.33m 3,494.69㎥" in row["blocked_reason"]
assert not any(BORROW_NAME in str(item) for item in handoff["unmatched_work_items"])