B08_Quantity 86 · B09_Estimation 111 파일을 old_code/ 로 옮김(지우지 않음). 화면은 메뉴·주소·단계 막대만 남은 빈 틀 둘 — main.py 라우터 13 개는 끊음. B07 이 빌려 쓰던 비탈 길이·면적은 필요한 함수만 B07_DesignDetail_Engine_SlopeGeometry 로 옮겨 적음(면적 적분·노면 면적·측점 묶음은 안 옮김) · 시험 하나를 새로 둠. B07 구조물도 조립(Cad_StandardSheet)은 2026-09-13 에 이미 도면 목록에서 빠져 부르는 곳이 없어 old_code 로 같이 보냄 — 구조물 그림은 되살리지 않음. B06 구조물 몫 조회는 빈 값으로 두어 화면이 그대로 서게 함. B08·B09 를 부르던 시험 25 개도 old_code/resources/tester 로 옮김. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PAdA5ThqmtVSsbzjusk1cJ
73 lines
3.1 KiB
Python
73 lines
3.1 KiB
Python
"""도쟈 한계거리 칸 (PLAN 5장 · 2026-09-13 판정 「도자 60 m 확정 — 설계 조건이라 칸으로」).
|
|
|
|
지키는 것
|
|
① 안 넣으면 정본 60 m · 넣으면 유토곡선 장비 경계가 그 값 · 종무대 20 m 는 규정이라 안 바뀜
|
|
② 화면이 기본값과 근거(근거 셋 일치)를 함께 받음
|
|
③ 종무대 이하 값은 저장에서 막음(도쟈 몫이 사라짐) · null 로 기본값 되돌림
|
|
④ B06 유토곡선 계산 문맥이 프로젝트 값을 실음
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from fastapi import FastAPI
|
|
from fastapi.testclient import TestClient
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
import B08_Quantity.B08_Quantity_Router_Earthwork as earthwork_router # noqa: E402
|
|
from B06_Section.B06_Section_Server_Calc_Prebuild import _mass_haul_context # noqa: E402
|
|
from common_util.common_util_project_settings import ( # noqa: E402
|
|
haul_equipment_limits,
|
|
haul_limit_choice,
|
|
load_settings,
|
|
)
|
|
|
|
PROJECT_ID = "55555555-5555-5555-5555-555555555555"
|
|
|
|
|
|
def test_기본은_60m_넣으면_그_값_종무대는_그대로() -> None:
|
|
assert haul_equipment_limits({}) == [("free_haul", 20.0), ("dozer", 60.0), ("dump_truck", None)]
|
|
assert dict(haul_equipment_limits({"dozer_haul_limit_m": 70}))["dozer"] == 70.0
|
|
assert dict(haul_equipment_limits({"dozer_haul_limit_m": 15}))["dozer"] == 60.0 # 종무대 이하
|
|
choice = haul_limit_choice({"dozer_haul_limit_m": 70})
|
|
assert (choice["value"], choice["default"], choice["chosen"]) == (70.0, 60.0, True)
|
|
assert "8-1-1" in choice["basis"] and "EARTH.DAT" in choice["basis"]
|
|
assert "1-2-7" in choice["free_haul_basis"]
|
|
|
|
|
|
def test_유토곡선_문맥이_프로젝트_경계를_싣는다() -> None:
|
|
limits = haul_equipment_limits({"dozer_haul_limit_m": 80})
|
|
context = _mass_haul_context(None, None, limits)
|
|
assert {row["key"]: row["max_distance_m"] for row in context["haul_equipment_limits"]} == {
|
|
"free_haul": 20.0,
|
|
"dozer": 80.0,
|
|
"dump_truck": None,
|
|
}
|
|
assert _mass_haul_context()["haul_equipment_limits"][1]["max_distance_m"] == 60.0
|
|
|
|
|
|
@pytest.fixture()
|
|
def client(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> TestClient:
|
|
async def fake_run(func, *args):
|
|
return "project"
|
|
|
|
monkeypatch.setattr(earthwork_router, "run_with_connection", fake_run)
|
|
monkeypatch.setattr(earthwork_router, "resolve_stored_project_path", lambda _p: str(tmp_path))
|
|
app = FastAPI()
|
|
app.include_router(earthwork_router.router)
|
|
return TestClient(app)
|
|
|
|
|
|
def test_저장은_종무대_이하를_막고_null_로_되돌린다(client: TestClient, tmp_path: Path) -> None:
|
|
url = f"/api/projects/{PROJECT_ID}/quantity/settings"
|
|
assert client.put(url, json={"dozer_haul_limit_m": 20}).status_code == 400
|
|
assert client.put(url, json={"dozer_haul_limit_m": 70}).status_code == 200
|
|
assert load_settings(tmp_path)["quantity"]["dozer_haul_limit_m"] == 70
|
|
assert client.put(url, json={"dozer_haul_limit_m": None}).status_code == 200
|
|
assert load_settings(tmp_path)["quantity"]["dozer_haul_limit_m"] is None
|