- Sangeun_Text 새 render · foot — 풀이 블록 줄 값(B09 수량 · 단가 · 금액) + 문서 셈 답(입력 · 공식 · 표 값 · 단위) · 수 꼴 · 단위 · 금액 줄 꼴 = master_doc_text(화면 줄 쌓기 산출근거 규칙) - Sangeun _env · _captured · _Prices · price_of 지움 · Solver._text = render 한 번(못 지으면 빈 글 · 값 그대로) - Sangeun_Sum 옛 shown · _cut · places · sums · scope · extra · totals 지움(doc_* 만) - helper_855_engine 옛 대조 기준 _old_env · _old_captured(test_855_trace) - test_155_5 · test_157_1 · test_155_b09_sources — 엑셀 꼴 글자 대신 새 규칙 결과(글 금액 = 블록 · 계 · Q 공식 줄 · 값 넣은 수량 식 · ÷ 배 · 원) - 골든 855_b09 글 5 갈래 다시 뜸(전 → 후 견본 tmp 표) · 값 10 갈래 같음 · 옛 글이 블록 값과 어긋나던 자리(옛 키 단가 0) 바로잡힘 - B09 옛 엔진 부름 37 → 0 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
75 lines
3.6 KiB
Python
75 lines
3.6 KiB
Python
"""157-1 · 855-F B9-4 산근 글 머리 = 문서 공식 줄 · 157-3 기계 번호 = 「이름 규격」(`Sangeun_Text`).
|
||
|
||
- 공식 줄 = 「이름 = 이름식 = 값 넣은 식 = 값 단위」(GF000064 일수 · 중간이 중간을 부름) · 만약 = 걸린 갈래만
|
||
- 표 · 하위 결과 값 = 「이름 = 값 단위」(넷까지 한 줄 · 화면 공식 묶음) · 입력 = 「이름 : 설명 = 값 단위」
|
||
- 수량 식 = 금액 줄 안 값 넣은 식 「× (2 × 0.098302)」(머리 「… 수량 =」 줄 없음)
|
||
- 호표 줄 · 계 = 산근 풀이(`Sangeun.Solver`) 줄 글 · 금액 그대로
|
||
"""
|
||
|
||
import copy
|
||
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 import B09_Estimation_Sangeun as sg # noqa: E402
|
||
from M02_MasterTemplete import M02_Item_Prices as item_prices # noqa: E402
|
||
|
||
|
||
def _whole(codes, edit=None):
|
||
files = copy.deepcopy(item_prices.to_json(item_prices.collect(codes)))
|
||
if edit:
|
||
for data in files.values():
|
||
for row in data.get("줄") or []:
|
||
if isinstance(row, dict) and row.get("키") == codes[0]:
|
||
edit(row)
|
||
return item_prices.load_prices(files)
|
||
|
||
|
||
def test_중간이_중간을_부름_값_넣은_식까지():
|
||
block = _solver(_whole(["GF000064"]), "GF000064", {})
|
||
assert (
|
||
"일수 = 1 ÷ 수집량 × (1 + 할증 ÷ 100) = 1 ÷ 11.19 × (1 + 10 ÷ 100) = 0.098302 일/㎥"
|
||
) in block["head"]
|
||
assert "할증 = 소형가선 집재 숲가꾸기 주 속 수 총 소요인력 할증 = 10 %" in block["head"]
|
||
worker = next(ln for ln in block["lines"] if ln["name"] == "보통인부")
|
||
assert "× (2 × 0.098302) 인 = " in worker["text"][0] # 수량 식 = 금액 줄 안
|
||
|
||
|
||
def test_하위_결과_값_줄():
|
||
block = _solver(_whole(["GF000089"]), "GF000089", {})
|
||
assert "작업량 = 39.293 ㎥/hr" in block["head"]
|
||
assert "E입력 : 0.45" in block["head"]
|
||
assert all("× (1 ÷ 39.293) 시간 = " in t for t in block["lines"][0]["text"])
|
||
|
||
|
||
def test_만약_걸린_갈래_입력_설명_기계_이름():
|
||
block = _solver(_whole(["GF000297"]), "GF000297", {"흉고직경": 20})
|
||
head = block["head"]
|
||
assert "흉고직경 : 가슴높이(1.2m) 지름(표 구간 안 값) = 20 ㎝" in head
|
||
assert "굴착기 = 굴착기(무한궤도) 0.6㎥" in head # 157-3 원문번호 '0201-0060' 대신
|
||
assert "기계 = 1" in head and not [t for t in head if "0201-" in t]
|
||
labor = next(ln for ln in block["lines"] if ln["name"] == "특별인부")
|
||
assert "× (0.56 × (1 - 0 ÷ 100)) 인 = " in labor["text"][0]
|
||
|
||
|
||
def _solver(whole, code, given):
|
||
"""841-1 산근 풀이 단가 = M02 엔진(사본 단가 묶음) — 시험 단가 안 넣음."""
|
||
return sg.Solver().add(whole, {"code": code, "given": given}, "s1")
|
||
|
||
|
||
def test_호표_줄_계는_산근_풀이와_같음():
|
||
"""함수 줄이 늘어도 꼬리(호표 줄 · 계)는 산근 풀이 줄에 그대로 얹힘 — 금액 그대로."""
|
||
for code, given in (("GF000089", {}), ("GF000064", {}), ("GF000297", {"흉고직경": 20})):
|
||
whole = _whole([code])
|
||
block = _solver(whole, code, given)
|
||
parts = " + ".join(
|
||
f"{n} {block[p]:,.0f}" for p, n in zip(sg.PARTS, ("노무비", "재료비", "경비"))
|
||
)
|
||
assert block["foot"] == f"계 : {parts} = {block['sum']:,.0f}", code
|
||
assert all(ln.get("text") for ln in block["lines"]), code
|
||
assert any(" 수량 = " in t or " = " in t for t in block["head"]), code
|
||
assert not [t for ln in block["lines"] for t in ln["text"] if " 수량 = " in t], code
|