feat(b08): 거리이정표 읽기 = 운반 행마다 상자 자동 · 모델 haul · ref (251-2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LLCk2y5xE8YGVgjbTntWsY
This commit is contained in:
2026-10-11 01:10:49 +09:00
co-authored by Claude Opus 5.5
parent 5770cb4ce7
commit 0e6da95c95
4 changed files with 73 additions and 1 deletions
@@ -48,3 +48,31 @@ def test_B09_운반_줄_옛_키_그대로_새_묶음_키():
assert items["haul:remicon"]["name"] == "레미콘운반" and items["haul:remicon"]["unit"] == "㎥"
assert all(i["section"] == "3" for i in items.values())
assert {"haul:1", "haul:2", "haul:3", "haul:4", "haul:5", "haul:6"} <= set(items)
def test_251_2_거리이정표_운반_상자_자동():
from B08_Quantity.B08_Quantity_Haul import with_haul_routes
groups = haul_groups(_mats(ROWS))
data = {"site": {}, "base": {"enabled": False}, "routes": [
{"id": "h-sand", "name": "골재상", "haul": "sand", "rows": [{"item": "모래"}]},
{"id": "u1", "name": "내 상자", "rows": []},
]} # fmt: skip
out = with_haul_routes(data, groups)
by = {r["id"]: r for r in out["routes"]}
assert by["h-sand"]["name"] == "골재상" # 있는 상자 그대로
assert "u1" in by # 사용자 상자 그대로
new = by["h-remicon"]
assert (new["name"], new["address"], new["linked"], new["haul"]) == ("", "", False, "remicon")
assert new["rows"] == [{"item": "레미콘", "dest": "start", "note": ""}]
assert len([r for r in out["routes"] if r.get("haul")]) == len(groups)
assert data["routes"][0] is out["routes"][0] and len(data["routes"]) == 2 # 원본 안 바뀜
def test_251_2_서버_모델_읽기_길():
from B08_Quantity.B08_Quantity_Router_Milestone import Route
r = Route(id="h-sand", haul="sand", ref={"tab": "logic", "code": "GF000284"})
assert r.haul == "sand" and r.ref == {"tab": "logic", "code": "GF000284"}
src = (ROOT / "B08_Quantity" / "B08_Quantity_Router_Milestone.py").read_text(encoding="utf-8")
assert "with_haul_routes(read_data(root), groups)" in src