- 엔진 = old_code B08_Quantity_Engine_EarthworkTable.py 복사(B08_Quantity_Engine_Earthwork.py) · 계산식 그대로 - 고친 곳 = 입력부(암 종류 없으면 암 지반 유형) · 줄 cut_rock_kind · 합계 리핑암 · 발파암 칸 - 길 = GET /quantity/earthwork — B06 횡단 설계 저장 단면적(확정 노선 · 없으면 최신) · 환산계수 = 유토곡선과 같은 mixed_conversion_factors · 아무것도 안 씀 - 화면 = 측점 · 거리 · 절토(토사 · 리핑암 · 발파암) · 측구터파기(토사 · 암) 각 단면적 · 입적 · 보정량 · 보정량계 · 성토 · 유용토 · 차인토량 · 누가토량 · 합계 줄 - 옛 시험 test_b08_earthwork_table.py 는 가져오는 경로만 새 엔진으로 · 새 시험 test_61_3_b08_earthwork_kinds.py Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UoSr2sqvYtBf1dtQdus88s
56 lines
2.1 KiB
Python
56 lines
2.1 KiB
Python
"""B08 3탭 토적표 — 옛 엔진 복사본의 고친 곳만 (PLAN 61-3).
|
||
|
||
계산식은 옛 시험(test_b08_earthwork_table.py · 경로만 새 엔진으로)이 잼. 여기서는
|
||
① 암 종류가 없으면 암 지반 유형 · ② 줄의 `cut_rock_kind` · ③ 합계의 리핑암 · 발파암 칸.
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
import pytest
|
||
|
||
ROOT = Path(__file__).resolve().parents[2]
|
||
sys.path.insert(0, str(ROOT))
|
||
|
||
from B08_Quantity.B08_Quantity_Engine_Earthwork import ( # noqa: E402
|
||
StationArea,
|
||
build_table,
|
||
)
|
||
|
||
FACTORS = {
|
||
"soil": {"compacted": 0.9},
|
||
"ripping_rock": {"compacted": 1.15},
|
||
"blasting_rock": {"compacted": 1.3},
|
||
}
|
||
|
||
|
||
def test_암_종류는_설계값_없으면_지반유형() -> None:
|
||
old = StationArea.from_design(0, {"cut_rock_area_m2": 2.0, "ground_type": "blasting_rock"})
|
||
assert old.cut_rock_kind == "blasting_rock"
|
||
soil = StationArea.from_design(0, {"ground_type": "soil"})
|
||
assert soil.cut_rock_kind is None
|
||
now = StationArea.from_design(
|
||
0, {"ground_type": "blasting_rock", "cut_rock_kind": "ripping_rock"}
|
||
)
|
||
assert now.cut_rock_kind == "ripping_rock"
|
||
|
||
|
||
def test_암_칸은_갈래별_합계() -> None:
|
||
stations = [
|
||
StationArea(chainage_m=0, cut_rock_area_m2=2.0, cut_rock_kind="ripping_rock"),
|
||
StationArea(chainage_m=20, cut_rock_area_m2=4.0, cut_rock_kind="ripping_rock"),
|
||
StationArea(chainage_m=40, cut_rock_area_m2=6.0, cut_rock_kind="blasting_rock"),
|
||
]
|
||
table = build_table(stations, FACTORS)
|
||
kinds = [row["cut_rock_kind"] for row in table["rows"]]
|
||
assert kinds == ["ripping_rock", "ripping_rock", "blasting_rock"]
|
||
t = table["totals"]
|
||
# 0~20: (2+4)/2×20 = 60 리핑 · 20~40: (4+6)/2×20 = 100 발파(현 측점 갈래 — 옛 엔진 규칙)
|
||
assert t["cut_ripping_rock_volume_m3"] == pytest.approx(60)
|
||
assert t["cut_blasting_rock_volume_m3"] == pytest.approx(100)
|
||
assert t["cut_ripping_rock_adjusted_m3"] == pytest.approx(60 * 1.15)
|
||
assert t["cut_blasting_rock_adjusted_m3"] == pytest.approx(100 * 1.3)
|
||
assert t["cut_rock_volume_m3"] == pytest.approx(160)
|