- 있는 키 그대로(spoil_bank · borrow_pit) · 컨테이너 = 정의 그룹 「상세 내용」(gspoildetail · gborrowdetail) · 잇기 = group_items · 집계 그룹마다 한 줄 - 부피 = 옛 용량 키 capacity_m3(B06 사토 배분이 읽는 자리) · b05 손 입력 · 옛 칸(쌓는 쪽 · 비탈 기울기 · 추가 운반거리 · 면적)은 지난 정의 값으로 남음 - 이름 유용토운반작업장(사토장) · 정의 판 7 · 이력 판_6 - 정의 그룹 있는 종류도 종류 단위 잇기 줄 가림 · 그룹 상자 최소 폭 0(긴 잇기 이름이 패널 밖으로 밀던 것) - 시험 test_52_9_spoil_borrow · ui_checks/52-9_사토장_토취장(B05 = B06 · 저장 → 다시 열기 · 되돌림) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MPcuokNm1ZR2kqgGGDfaJA
75 lines
3.1 KiB
Python
75 lines
3.1 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
|