Files
Aislo/resources/tester/test_842_1_b09_fixed_aside.py
T
eomsangdonandClaude Sonnet 5.5 5b65e9470d fix(842-1): B09 고정 줄 이은 자재 별도 · 관급 = 자재대에 한 번 — 거창 안내판 줄 사라진 50,000 되살림
- 고정 줄 이은 자재가 별도 · 관급이면 대가 안 0 원 + 그 몫 `aside` → 집계 `aside` 줄(자재대 수량)
  (`Calc_Labor` py · ts 짝 `_fixed_apart` · `Summary._fixed_lines`) — 기본 표시는 M02 자재표시 그대로
- 거창 직접비 합 = 엑셀(384,916,227) · 견본 넷 사라진 재료 0 · 겹쳐 셈 0
- 지킴 시험 `test_842_1_b09_fixed_aside`(재료 · 고정 · 관급 · 기계 겸 · 거울) + `test_707_7` 전수 시험
- `test_707_7` 낡은 기대(거창 gap 50000 · 다시 부르기 384866227) 고침

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 18:16:21 +09:00

83 lines
3.1 KiB
Python

"""842-1 B09 — 대가 안 0 원이 된 재료는 자재대(`aside`)에 꼭 한 번 · 겹쳐 세지 않음.
고정 줄이 이은 자재(`link.material`)가 별도 · 관급이면 대가 안 0 원 + 그 몫 = 줄 `aside` →
집계표 `aside` 줄(자재대 수량) · 재료 줄 · 붙인 줄 · 관급도 같은 길 · 직접계산 = `aside` 없음.
거울: `B09_Estimation_Calc_Labor.py` ↔ `.ts` (`fixedApart`).
"""
import json
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 B09_Estimation.B09_Estimation_Calc_Labor import compute_labor # noqa: E402
from B09_Estimation.B09_Estimation_Summary import block_lines, totals # noqa: E402
from resources.tester.test_145_2_b09_labor_calc import _b, _l, _same, _ts # noqa: E402
SHEETS = {
"labor": [],
"material": [
{"key": "MA", "price": 50000, "supply": "별도"},
{"key": "MB", "price": 800, "supply": "관급"},
{"key": "MC", "price": 300, "supply": None},
],
"machine": [],
"gaps": [],
}
def _fix(name, qty, mat, price, **link):
own = {"labor": 0.0, "material": price, "expense": 0.0}
return {
"kind": "fixed",
"name": name,
"qty": qty,
"own": own,
"link": {"material": mat, **link},
}
DAEGA = {
"blocks": [
_b(
"DG1",
"품셈",
"안내판",
[
_fix("지주", 1, "MA", 50000), # 별도 → 대가 안 0 · 자재대 50000
_fix("관급 줄", 2, "MB", 800), # 관급 → 자재대(관급)
_fix("직접 줄", 3, "MC", 300), # 직접계산 → 대가 안
_fix(
"기계 겸", 1, "MA", 50000, machine="X1"
), # 기계 이음이 먼저여도 자재대 몫은 감
{**_l("material", "MA", 4), "own": {"material": 50000}}, # 재료 줄도 같은 자재
],
),
],
"owners": {"x": "DG1"},
}
def test_고정_줄_자재_대가_안_0_자재대에_한_번():
got = compute_labor(DAEGA, SHEETS)["daega_blocks"][0]
by = {ln["name"]: ln for ln in got["lines"]}
assert by["지주"]["amounts"]["material"] == 0 and by["지주"]["aside"] == 50000
assert by["관급 줄"]["amounts"]["material"] == 0 and by["관급 줄"]["aside"] == 1600
assert by["직접 줄"]["amounts"]["material"] == 900 and "aside" not in by["직접 줄"]
assert got["material"] == 900 # 대가 안 = 직접계산 줄만
lines = block_lines([got])[got["key"]]["lines"]
assert [x for x in lines if x["kind"] == "material"] == [ # 직접 줄만 일반 재료 줄
{"kind": "material", "key": "MC", "qty": 3}
]
aside = totals({"bill": {"rows": [{"kind": "item", "qty": 1, "ref": {"key": got["key"]}}]}},
{got["key"]: {"lines": lines}})[0]["aside"] # fmt: skip
assert aside == {"MA": 1 + 1 + 4, "MB": 2} # 재료 줄 4 + 고정 줄 둘 = 한 번씩 모음
def test_거울_파이썬_TS():
py = json.loads(json.dumps(compute_labor(DAEGA, SHEETS), ensure_ascii=False))
assert _same(py, _ts(DAEGA, SHEETS, {})["out"])