diff --git a/resources/tester/test_b09_fuel_kind_vibrator.py b/resources/tester/test_b09_fuel_kind_vibrator.py new file mode 100644 index 00000000..5e48d47b --- /dev/null +++ b/resources/tester/test_b09_fuel_kind_vibrator.py @@ -0,0 +1,96 @@ +"""연료 종류(휘발유) · 콘크리트 진동기 — 2026-09-14 브레인 661 뒤 ①②. + +② 운전경비표 `fuel_kind` 를 조립이 안 읽어 **휘발유 기계에 경유값**이 붙고 있었음(플레이트 콤팩터 · + 진동기 · 믹서 · 래머 · 커터) — 종류대로 그 유가(전국·시도 둘 다)로 섬. +① 콘크리트 진동기 — 원문 8-3 (4611) 두 줄이 한 칸에 뭉쳐 규격·손료계수가 비었음 → 원문값 되살림 + (전기식 플렉시블형 ø45(0.75㎾) 4,935 · 엔진식 플렉시블형 ø45(2.6㎾) 5,101). 산림 12-15 「봉상후렉시블(45mm) + Q=5.4㎥/hr」 은 전기·엔진을 안 적음 → 12-34-1 「콘크리트 진동기(3.5HP)」(= 2.6㎾) · 운전경비표에 엔진식만 + 있는 것을 근거로 엔진식 4611-0350. 집수정 구체콘크리트 갈래가 이제 섬(㉯ ⑴ 조건이 풀림). +""" + +from __future__ import annotations + +import json +from decimal import Decimal +from pathlib import Path + +from B09_Estimation.B09_Estimation_UnitPrice import cached_build, detail_of + +ROOT = Path(__file__).resolve().parents[2] +DATA = ROOT / "resources" / "data_cost_input_value" + + +def _oil(file: str, key: str) -> dict: + return json.loads((DATA / file).read_text(encoding="utf-8"))["variables"][key] + + +def test_휘발유_기계는_휘발유값_경유_기계는_경유값() -> None: + book = cached_build().book + fuels = {r.ref_code for r in book.details["X-1730-0015"] if r.ref_code.startswith("M-FUEL-")} + assert fuels == {"M-FUEL-휘발유"}, fuels + gasoline = Decimal(str(_oil("oil_2026-08-14.json", "oil_gasoline")["value"])) + assert book.titles["M-FUEL-휘발유"].slots[-1] == gasoline or gasoline in book.titles[ + "M-FUEL-휘발유" + ].slots + diesel_rows = {r.ref_code for r in book.details["X-0201-0070"] if r.ref_code.startswith("M-FUEL-")} + assert diesel_rows == {"M-FUEL-경유"} + + +def test_시도를_고르면_휘발유도_그_시도값() -> None: + records = _oil("oil_regional_2026-09-09.json", "oil_gasoline")["records"] + seoul = next(Decimal(str(r["value"])) for r in records if r["sido_code"] == "01") + book = cached_build(fuel_region="01").book + assert seoul in book.titles["M-FUEL-휘발유"].slots + assert "서울" in book.titles["M-FUEL-휘발유"].spec + + +def test_기계_하나_시간당_사용료도_연료_종류대로() -> None: + from B09_Estimation.B09_Estimation_MachineOperating import hourly_cost_of, load_fuel_price + + gasoline, _ = load_fuel_price(kind="휘발유") + diesel, _ = load_fuel_price() + assert gasoline != diesel + cost = hourly_cost_of("1730-0015") # 휘발유 1.0 L/hr · 잡품 20% + assert cost.money.material == Decimal("1.0") * Decimal("1.2") * gasoline, cost + + +def test_진동기_원문값_되살림() -> None: + from B09_Estimation.B09_Estimation_MachineCost import load_machine_catalog + + machines = load_machine_catalog().machines + assert machines["4611-0350"].specification == "엔진식 플렉시블형 ø45(2.6㎾)" + assert machines["4611-0350"].loss_coefficient_per_hour == Decimal("0.0005101") + assert machines["4611-0075"].specification == "전기식 플렉시블형 ø45(0.75㎾)" + assert machines["4611-0075"].loss_coefficient_per_hour == Decimal("0.0004935") + + +def test_집수정_구체콘크리트_갈래가_엔진식_진동기로_섬() -> None: + build = cached_build() + rows = {r["ref_code"]: Decimal(r["quantity"]) for r in detail_of(build, "B-FP-12-15#구체콘크리트")["rows"] if r.get("ref_code")} + assert rows["X-4611-0350"] == Decimal(1) / Decimal("5.4"), rows + left = " ".join(build.unattached.get("FP-12-15", [])) + assert "봉상후렉시블" not in left and "구체콘크리트" not in left, left + + +def test_진동기_별칭_사유에_12_15_는_전기_엔진을_안_적음() -> None: + from common_util.common_util_aliases import load_aliases + + row = next(r for r in load_aliases("resource") if r["to"] == "4611-0350") + assert row["scope"] == "FP-12-15" + assert "전기·엔진을 안 적음" in row["basis"] and "12-34-1" in row["basis"], row + + +def test_중기경비_장은_갈래대로_잡품과_손료계수() -> None: + """661 뒤처리 — `#암석` 장이 조합 16%·비암석 계수로 보이던 자리.""" + from B09_Estimation.B09_Estimation_MachineExpenseSheet import machine_expense_sheets + + build = cached_build(dump_haul_m=("164.23",)) + sheets = {s["code"]: s for s in machine_expense_sheets(build)} + rock, combined = sheets["X-0201-0070#암석"], sheets["X-0201-0070#조합"] + assert rock["misc_material_percent"] == sheets["X-0201-0070"]["misc_material_percent"] + assert combined["misc_material_percent"] == "16" + assert rock["loss_coefficient"] == 2405 and sheets["X-0201-0070"]["loss_coefficient"] == 2085 + gasoline = next(s for s in sheets.values() if s["machine_code"] == "1730-0015") + assert Decimal(gasoline["fuel_price_per_liter"]) == Decimal( + str(_oil("oil_2026-08-14.json", "oil_gasoline")["value"]) + )