저장 자리(save_quantity_settings)는 라우터에 남김 · 이름은 다시 내보냄 · 소스 글자 시험 하나가 옮긴 파일을 봄 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016VBGFXB9AbJBwXP19z75Qq
71 lines
3.2 KiB
Python
71 lines
3.2 KiB
Python
"""초류종자살포 잎 고르기 — 2026-09-14 브레인 차례 ㉮(B08 나머지 탭 훑기).
|
|
|
|
매핑이 부모(FP-05-24 씨앗뿜어붙이기 · 갈래 고르기형)를 가리켜 B09 가 「잎 미선택」으로 막는데 고를 칸이 없었음
|
|
→ 금액이 영영 안 섬(면고르기와 같은 병). 산출 조건 「초류종자살포 비탈면 토질」(5-24-1 일반 · 5-24-2 마사토)
|
|
칸 · 매핑 `leaf_from`·`leaf_codes` 가 잎 코드로 잇고 · 비면 금액 없이 입력 사유 · 제안값 없음(지어내지 않음).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
if str(ROOT) not in sys.path:
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from B08_Quantity.B08_Quantity_Engine_EarthworkSummary import SEED_SPRAY_GROUNDS # noqa: E402
|
|
from B08_Quantity.B08_Quantity_Engine_Handoff import build_handoff # noqa: E402
|
|
|
|
SUMMARY = {"rows": [{"group": "초류종자살포", "item": "", "spec": "씨드스프레이", "unit": "㎡",
|
|
"amount": 1500.0, "application_ratio_pct": 100.0}]} # fmt: skip
|
|
|
|
|
|
def _row(**inputs) -> dict:
|
|
rows = build_handoff(summary_table=SUMMARY, **inputs)["work_items"]
|
|
return next(r for r in rows if r["name"] == "초류종자살포")
|
|
|
|
|
|
def test_토질을_고르면_잎_코드로_감() -> None:
|
|
assert _row(seed_spray_ground="일반")["work_item_code"] == "FP-05-24-01"
|
|
row = _row(seed_spray_ground="마사토")
|
|
assert row["work_item_code"] == "FP-05-24-02" and not row["blocked_kind"], row
|
|
|
|
|
|
def test_토질이_비면_부모_코드에_금액_없이_입력_사유() -> None:
|
|
row = _row()
|
|
assert row["work_item_code"] == "FP-05-24"
|
|
assert row["blocked_kind"] == "input_missing", row
|
|
assert "일반·마사토" in row["blocked_reason"] and "산출 조건" in row["blocked_reason"]
|
|
|
|
|
|
def test_선택지는_마스터_잎_이름과_같음() -> None:
|
|
from B09_Estimation.B09_Estimation_ResourceAxis import load_work_item_master
|
|
|
|
leaves = {
|
|
n["work_item_code"]: n["name"].split("/")[-1]
|
|
for n in load_work_item_master()["work_items"]
|
|
if n.get("parent_code") == "FP-05-24"
|
|
}
|
|
assert leaves == {"FP-05-24-01": "일반", "FP-05-24-02": "마사토"}
|
|
assert set(SEED_SPRAY_GROUNDS) == set(leaves.values())
|
|
|
|
|
|
def test_산출_조건이_받고_선택지_밖은_안_정함으로() -> None:
|
|
source = (ROOT / "B08_Quantity" / "B08_Quantity_Router_Earthwork.py").read_text("utf-8")
|
|
# 값 거르기는 2026-09-15 `_Router_Earthwork_Settings` 로 가름(700줄) — 규칙은 그대로.
|
|
settings = (ROOT / "B08_Quantity" / "B08_Quantity_Router_Earthwork_Settings.py").read_text(
|
|
"utf-8"
|
|
)
|
|
assert '("seed_spray_ground", SEED_SPRAY_GROUNDS)' in settings
|
|
assert 'table["seed_spray_choices"]' in source
|
|
material = (ROOT / "B08_Quantity" / "B08_Quantity_Router_Material.py").read_text("utf-8")
|
|
assert 'seed_spray_ground=settings.get("seed_spray_ground") or None' in material
|
|
|
|
|
|
def test_화면_칸이_있고_저장_읽기에_실림() -> None:
|
|
page = (ROOT / "B08_Quantity" / "B08_Quantity_UI_Page.ts").read_text("utf-8")
|
|
assert "seed_spray_ground: draft.seed_spray_ground" in page
|
|
assert "seed_spray_ground: (stored.seed_spray_ground" in page
|
|
assert "appendSeedSprayField(" in page
|