Files
Aislo/resources/tester/test_52_9_spoil_borrow.py
T
eomsangdonandClaude Opus 5.5 8379154730 feat(B05): 사토장 기준 측점 = 토취장과 같은 꼴(54-7) — 기준 측점 한 점 · B06 사토 배분 이어 씀
- 정의 사토장(spoil_bank) 배치 구간 → 부지 · 정의 판 14(이력 판_13) · 화면은 토취장 길 그대로(기준 측점 No + 거리)
- 옛 구간 저장분 = 읽을 때 기준 측점(옛 기준 → 시작) · 시작 · 종료 뺌 · 파일은 다음 [저장]까지 그대로
- B06 사토 배분 = 기준 측점에 가장 가까운 측점 하나(가운데면 앞 측점) × 대표 길이(앞뒤 절반)
- 바뀌는 값: 담은 양 같음 · 쌓는 측점 구간 여럿 → 하나 · 그 측점 폭 · 면적 커짐
- 시험 test_b06_spoil_fill_allocation(기준 측점 꼴 · 옛 꼴 읽기 · 가까운 측점) · test_52_9 · 화면 ui_checks/54-7

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYJJRCfHfdCGNhmXTjQKV7
2026-10-06 10:49:15 +09:00

91 lines
3.8 KiB
Python

"""PLAN 52-9 — 안전부대용지 › 사토장 · 토취장 = 사용자 구조물 표 08.
· 있는 종류 키 그대로(spoil_bank · borrow_pit) · 기준 측점 + 컨테이너 「상세 내용」(정의 그룹) 하나
· 부피 손 입력 = 옛 용량 키 `capacity_m3`(B06 사토 배분이 읽는 자리)
· 옛 칸은 정의에서 빼 지난 정의 값
· 잇기 = 그룹 id(`group_items`) — 집계 표가 그룹마다 한 줄
"""
import json
from pathlib import Path
from B05_Profile.B05_Profile_Structures_Schema import DEFINITION_PATH, load_structure_types
from B06_Section.B06_Section_Engine_SpoilFill import spoil_sites
from M02_MasterTemplete.M02_Table_Fill import _with_group_items
from M02_MasterTemplete.StructOptions import M02_SO_Definition
from M02_MasterTemplete.StructOptions.M02_SO_Groups import groups_of
KINDS = {
"spoil_bank": ("유용토운반작업장(사토장)", "사토장 부피", "gspoildetail"),
"borrow_pit": ("토사채취장(토취장)", "토취장 부피", "gborrowdetail"),
}
def test_옵션은_부피_하나_손_입력():
by_id = {t.type_id: t for t in load_structure_types()}
for type_id, (name, label, _) in KINDS.items():
item = by_id[type_id]
assert item.group == "E" and item.name == name and item.managed_by is None
assert [o.key for o in item.options] == ["capacity_m3"]
volume = item.options[0]
assert volume.label == label and volume.input == "number" and volume.unit == "㎥"
assert volume.phase == "b05" and not volume.required and volume.default is None
def test_컨테이너_상세_내용_하나_부피를_담음():
groups = groups_of()
for type_id, (_, _, gid) in KINDS.items():
assert groups[type_id] == [{"id": gid, "name": "상세 내용", "options": ["capacity_m3"]}]
def test_정의_검사_통과_판_이력():
doc = json.loads(Path(DEFINITION_PATH).read_text("utf-8"))
assert M02_SO_Definition.check(doc) == []
assert M02_SO_Definition.history_path(doc["판"] - 1).is_file()
def test_잇기는_그룹마다_집계_한_줄():
link = {"source": "SS", "code": "SS-000001", "name": "사토장"}
rows = _with_group_items(
[
{
"type_id": "spoil_bank",
"복사본": "s1",
"summary_item": None,
"group_items": {"gspoildetail": link},
}
]
)
assert [r["복사본"] for r in rows] == ["s1", "s1__gspoildetail"]
assert rows[1]["summary_item"] == link and rows[1]["그룹"] == "상세 내용"
def test_B06_사토_배분은_부피를_그대로_읽음_옛_값도():
new = {"type_id": "spoil_bank", "start_m": 20, "end_m": 40, "options": {"capacity_m3": 150}}
old = {
"type_id": "spoil_bank",
"start_m": 60,
"end_m": 80,
"options": {"capacity_m3": 90, "side": "좌", "area_m2": 30, "extra_distance_m": 5},
}
sites = spoil_sites([new, old])
assert [s["capacity_m3"] for s in sites] == [150.0, 90.0]
assert sites[0]["side_option"] is None and sites[1]["side_option"] == "좌"
assert sites[1]["extra_distance_m"] == 5
def test_54_7_사토장_기준_측점_꼴은_토취장과_같음_옛_구간은_기준_측점으로_읽음():
from B05_Profile.B05_Profile_Structures_Schema import StructureInstance
by_id = {t.type_id: t for t in load_structure_types()}
assert by_id["spoil_bank"].placement == by_id["borrow_pit"].placement == "site"
old = {"type_id": "spoil_bank", "placement": "interval", "start_m": 60, "end_m": 80}
for extra, station in (({"chainage_m": 70}, 70.0), ({}, 60.0)):
item = StructureInstance.model_validate({**old, **extra})
assert (item.placement, item.chainage_m, item.start_m, item.end_m) == (
"site",
station,
None,
None,
)