Files
Aislo/resources/tester/test_b09_composite_partial_parts.py
T
eomsangdonandClaude Opus 5 16d3461573 fix(b09): ㉱ 조립(묶음) 줄이 조각의 「일부만」·「밑수 없음」 을 올림 — 조각 제목만 있으면 온전한 금액처럼 서던 구조 결함
· 조각마다 보통 줄과 같은 두 검사 — 단가가 일부 몫만 섰거나(붙은 몫 N%) 밑수를 모르는 표면 묶음 금액을 안 세우고 어느 조각이 왜인지 사유
· 700줄 넘던 줄 만들기 파일에서 자재 줄(_material_row)을 자재 모듈로 그대로 옮김(순수 나누기 · 부르는 쪽 한 줄)

프로젝트 내역 그대로 · 잴 시험 둘 빨강→초록(온전한 조각 시험은 처음부터 초록) · 전체 시험 1705 + 367 통과

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

55 lines
2.2 KiB
Python

"""조립(묶음) 줄이 조각의 「일부만」·「밑수 없음」 을 올림 — 2026-09-14 브레인 ㉱ 첫째(구조 결함).
종전 `_composite_row` 는 조각 제목이 **있기만 하면** 금액에 더했음 → 조각 단가가 일부 몫만 섰거나(인력만)
밑수를 모르는 표여도 조립 줄이 **온전한 금액처럼** 섰음. 보통 줄은 그 둘을 막는데 조립 줄만 새던 자리.
⇒ 조각마다 보통 줄과 같은 두 검사 — 걸리면 금액을 안 세우고 어느 조각이 왜인지 사유.
"""
from __future__ import annotations
from B09_Estimation.B09_Estimation_BillOfQuantities import build_bill
from B09_Estimation.B09_Estimation_UnitPrice import cached_build
def _composite(parts: list[dict]) -> dict:
return {
"work_items": [
{
"work_item_code": None,
"name": "시험 묶음",
"spec": "",
"unit": "개소",
"quantity": "1",
"in_bill": True,
"composite_parts": parts,
"composite_not_ready": [],
}
],
"materials": [],
}
def _line(parts: list[dict]):
rows = build_bill(_composite(parts)).rows
return next(r for r in rows if r.code is None and r.name == "시험 묶음")
def test_일부만_선_조각이_있으면_묶음_금액을_안_세우고_까닭() -> None:
build = cached_build()
partial = next(c for c in build.partial_ratio if f"B-{c}" in build.book.titles)
line = _line([{"code": partial, "quantity": 1}])
assert line.amount_krw is None, (partial, line.amount_krw)
assert partial in line.note and "일부만" in line.note, line.note
def test_밑수_없는_조각도_같이_막음() -> None:
build = cached_build()
missing = next(c for c in build.basis_missing if f"B-{c}" in build.book.titles)
line = _line([{"code": missing, "quantity": 1}])
assert line.amount_krw is None and "밑수" in line.note, (missing, line.note)
def test_온전한_조각만이면_종전대로_금액() -> None:
line = _line([{"code": "FP-09-15-02", "quantity": 2}])
assert line.amount_krw and line.amount_krw > 0, line.note