Files
Aislo/resources/tester/test_707_b09_import_rates_prices.py
T
eomsangdonandClaude Opus 5.5 5d8d9a4fd3 test(841-1): B09 = M02 값 — 산근 · 대가 · 고정 줄 셈 다듬기 · 낡은 시험 정리 — C 걸음
코드
- 고정 줄 단가 = M02_Labor_Fixed.line(사본 묶음 · 이은 노임 · 자재 = 묶음 값) — B09 단가 책으로 다시 안 덮음
- 대가 · 산근 고친 칸 = 품만 실제로(단가 칸 덮기 줄 남던 흠 · 품 고친 뒤 줄 금액 다시 셈 흠 py · ts 짝)
- 산근 글 = 엔진 단가 셈 그대로 · 별도계상 재료 줄 끝 「· 별도계상 = 0.0」 · 계 줄 = 블록 합
- 노무비 · 중기목록 이름에서 규격 겹침 뗌 · TS 바탕 셈 이름 PARTS → MACHINE_PARTS(짝 시험이 TS 를 이어 붙일 때 겹침)

시험(고친 까닭 = 단가 원천이 B09 책 → M02 엔진 · 노임 · 기계 덮개 · 단가 고친 칸 · 중기사용료 걷음)
- 144 바탕 · 뼈대: 운전사 · 중기사용료 · 경비 · 덮개 시험 걷음 → 노무 · 중기 나열 · 사급 표시 · 자재만 책
- 145-1 · 145-2 · 155 · 157-1 · 166-2 · 166-6 · 719-3 · 719-4 · 723-4 · 778-4 · 792-3: 줄 단가 = own(엔진) · 산근 = Solver() · collect 새 부름 꼴
- 702 · 705-1 · 719-2: 단가 칸 덮개 = 안 읽음 · 고정 줄 = M02 셈(노임 새 판 따라가기 시험 걷음)
- 203-1 · 296 · 703-3 · 795-4: 단가 책 = 자재 줄로
- 707 · 707-6 · 707-7: 단가표 불러오기 = 자재만 · 거창 이은 안내판 줄 = M02 사본 셈(엑셀 −50,000)
- 201-1: 환율 · 중기사용료 표 걷음 · b09 저장 속도: 산근 앞 풀이 그대로(단가 표 같음 견줌 걷음)
- 대상 113 파일 764 통과 · 25 실패 = 원래 실패(formatMoney · formatPrice 없음 · 단위 글 ㎜ · sec · 719-1 · 796-2e · 717-4 · 721 · 311 · 243 · 246)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:57:01 +09:00

161 lines
6.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""707-2 원가계산서 요율 · 707-3 기초 단가표 불러오기 — 실무 xlsx 넷(EST 거창 · STmate 영월 · 울진 대흥 ·
울진 소광) · 이음 규칙 · 덮개 지킴(새 판 [업데이트] 뒤).
총액 대조 = 엑셀 비목 합 + 실은 요율 · 손입력으로 우리 식(`compute_total`) → 엑셀 총공사비:
대흥 = 같음 · 영월 = 「국가지점번호판검증수수료」 762,000 원만 다름(우리 표에 줄 없음) ·
거창 = 같음(708-2 퇴직공제부금비 셈 뒤) · 소광 = 산출근거 빈칸 율 넷 · 폐기물처리 줄.
"""
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 B09_Estimation import B09_Estimation_Import_Prices as ip # noqa: E402
from B09_Estimation import B09_Estimation_Import_Rates as ir # noqa: E402
from B09_Estimation import B09_Estimation_Store as store # noqa: E402
from B09_Estimation.B09_Estimation_Rates import rate_table # noqa: E402
K = ROOT / "resources" / "knowledge" / "original" / "실무문서"
FILES = {
"거창": "01.산불거창(거창북상병곡)/01.내역서/00.25년_산불_거창(거창,북상,병곡,산8외)내역+수량.xlsx",
"영월": "05. 동부청 영월/내역서/2024년 임도시설사업2차(산불진화_기번6)-영월.xlsx",
"대흥": "2024년 간선임도(기번3-울진.대흥)(공통)/1. 설계원본/01 내역자료/2024년 간선임도사업(기번3).xlsx",
"소광": "25년 산불진화임도(기번8)(울진소광)/"
"2025년 산불진화임도 신설사업(기번8 울진.금강송.소광.산29외).xlsx",
}
def _file(tag):
path = K / FILES[tag]
if not path.is_file():
pytest.skip(f"실무 xlsx 없음 — {tag}")
return path.name, path.read_bytes()
@pytest.fixture(scope="module")
def rates():
return {tag: ir.read_rates(*_file(tag)) for tag in FILES}
def test_707_2_요율_짝(rates):
dh = rates["대흥"]
assert dh["kind"] == "STmate" and rates["거창"]["kind"] == "EST"
assert len(dh["rates"]) == 13 # 율 줄 10 + 일반관리비 · 이윤 · 부가세
assert (dh["rates"]["indirect_labor"], dh["rates"]["safety"], dh["rates"]["profit"]) == (
14.5,
1.86,
15.0,
)
assert dh["estimate"]["safety_base"] == 5349000 # 「x1.86% + 5,349,000」
assert dh["estimate"]["procurement_fee_pct"] == 0.54 # 375,160 ÷ 69,474,220
gc = rates["거창"] # EST 요율 칸 · 건강보험 글 「13.595%」 대신 칸 3.595
assert (gc["rates"]["health"], gc["rates"]["care"], gc["rates"]["retirement"]) == (
3.595,
13.14,
2.3,
)
assert gc["estimate"]["safety_base"] == 0 # 글에 + 기초액 없음
assert gc["notes"] == [] # 708-2 퇴직공제부금비 = 셈(「셈 없음」 없음)
sk = rates["소광"]
assert sum("율 없음" in n for n in sk["notes"]) == 4 # 산출근거 빈칸 — 지금 율 그대로
assert any("페기물처리" in n for n in sk["notes"])
def test_707_2_총액_대조(rates):
got = {tag: ir.check(r, {}, rate_table()) for tag, r in rates.items()}
assert got["대흥"]["grand"] == got["대흥"]["excel_grand"] == 1201879000
assert got["대흥"]["differ"] == []
assert got["영월"]["excel_grand"] - got["영월"]["grand"] == 762000 # 국가지점번호판 줄 몫
assert set(got["영월"]["differ"]) == {"도급공사비", "총공사비"}
# 708-2 — 퇴직공제부금비 5,603,907(직노 × 2.3 %)가 순공사원가에 듦 → 총공사비 = 엑셀
assert got["거창"]["grand"] == got["거창"]["excel_grand"] == 744653000
assert got["거창"]["differ"] == []
lines = {ln["key"]: ln for ln in got["거창"]["lines"]}
assert lines["retirement"]["ours"] == lines["retirement"]["excel"] == 5603907
def test_707_3_단가표_읽기():
counts = {}
for tag in FILES:
got = ip.read_prices(*_file(tag))
counts[tag] = tuple(len(got[k]) for k in ip.KINDS)
# 841-1 자재만(노임 · 기계 단가표 걷음 — 노무 · 기계 단가 = M02 사본 값)
assert counts == {"거창": (52,), "영월": (55,), "대흥": (39,), "소광": (35,)}
BASE = {
"labor": [
{"key": "LB1", "name": "석공", "spec": "", "unit": "인", "price": 268908},
{"key": "LB2", "name": "보통인부", "spec": "", "unit": "인", "price": 172068},
],
"machine": [
{
"key": "EQ1",
"name": "굴착기(무한궤도)",
"spec": "0.7㎥",
"labor": 1,
"material": 2,
"expense": 3,
},
{
"key": "EQ2",
"name": "굴착기(무한궤도)",
"spec": "0.2㎥",
"labor": 1,
"material": 2,
"expense": 3,
},
], # fmt: skip
"compare": [
{"key": "MO1", "name": "휘발유", "spec": "전국평균", "unit": "L", "applied": 1863.25},
{"key": "MT1", "name": "레미콘", "spec": "25-18-80", "unit": "㎥", "applied": 92330},
],
}
def _m(name, spec, n):
return {"name": name, "spec": spec, "unit": "hr", "labor": n, "material": n, "expense": n}
READ = {
"labor": [
{"name": "석 공", "spec": "", "unit": "인", "price": 258935},
{"name": "보통인부", "spec": "", "unit": "인", "price": 172068}, # 책과 같음
{"name": "벌 목 부", "spec": "", "unit": "인", "price": 253243},
],
"machine": [
_m("굴삭기(무한궤도)", "0.7㎥", 10),
_m("굴삭기(타이어형)", "0.7㎥", 11), # 타이어 = 다른 기계
_m("굴삭기+브레이카", "0.7㎥", 12),
_m("굴삭기(무한궤도)", "0.2㎥", 13),
_m("굴삭기(무한궤도)", "0.2㎥", 14), # 같은 책 줄에 둘 = 못 고름
],
"material": [
{"name": "휘 발 유", "spec": "", "unit": "ℓ", "price": 1473}, # 이름 · 단위(ℓ = L)
{"name": "레미콘(관급)", "spec": "25-18-80", "unit": "m3", "price": 92330},
],
}
def test_707_3_이음_규칙():
user = {"labor_cover": {"LB2": 1}, "materials": {"MO1": {"pick": "유가", "supply": "관급"}}}
out = ip.propose(READ, BASE, user)
patch = out["patch"]
assert set(patch) == {"materials"} # 841-1 노임 · 기계 덮개 걷음
assert patch["materials"]["MO1"] == {"supply": "관급", "applied": 1473} # pick 뺌
assert "MT1" not in patch["materials"] # 「(관급)」 이름 다름 = 짝 없음
assert set(out["counts"]) == {"material"} and out["counts"]["material"]["linked"] == 1
def test_841_1_노임_기계_덮개_저장_안_함(tmp_path):
"""841-1 노임 · 기계 단가 덮개 걷음 — 옛 사용자 값은 저장 때 버림(노무 · 기계 = M02 사본 값)."""
cover = {"labor_cover": {"LB1": 258935},
"machine_cover": {"EQ1": {"labor": 10, "material": 10, "expense": 10}}} # fmt: skip
saved = store.write_user(tmp_path, cover)
assert "labor_cover" not in saved and "machine_cover" not in saved