fix(m01): /text 도 풀리지 않는 중간값은 비우고 그 줄만 금액 비움 (PLAN 6장 넷째 줄)
- _env_of 가 EmptyInput 을 Blank 로 받아 /calc 와 같은 빈 줄 규칙 - 멈춤(calc) 46 로직 329 조합: /text 멈춤 309 → 0 · 계는 /calc 와 같음 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1MKKZKpUHTPKb513FneU8
This commit is contained in:
@@ -385,7 +385,10 @@ def _env_of(master, row: dict, given: dict, depth: int = 0) -> dict:
|
||||
return {spec["이름"]: given[spec["이름"]] for spec in specs if spec["이름"] in given}
|
||||
env = mf._inputs(row, given)
|
||||
for step in row.get("중간", []):
|
||||
env[step["이름"]] = mf.evaluate(mf.parse(step["식"]), env, master, depth)
|
||||
try:
|
||||
env[step["이름"]] = mf.evaluate(mf.parse(step["식"]), env, master, depth)
|
||||
except mf.EmptyInput as e: # 못 구한 중간값 — `run` 과 같이 쓰는 줄만 비움
|
||||
env[step["이름"]] = mf.Blank(str(e))
|
||||
return env
|
||||
|
||||
|
||||
|
||||
@@ -509,3 +509,14 @@ def test_수량_식_안_로직_조각은_그_로직_이름() -> None:
|
||||
line = next(x for x in _text_of("GC000111") if x["이름"] == "리퍼 기계경비")
|
||||
pill = next(p for p in line["조각"] if p["kind"] == "로직")
|
||||
assert pill["글"] == "굴착기(무한궤도) 시간당 기계경비" and pill["참조"]["키"] == "GC000267"
|
||||
|
||||
|
||||
def test_표에_없는_입력_조합은_그_줄만_비우고_글은_그대로() -> None:
|
||||
"""/calc 와 같은 빈 줄 규칙 — 풀리지 않는 중간값은 /text 도 멈추지 않음."""
|
||||
got = store.text("GC001000", {**store.auto("GC001000")["값"], "시공구분": "기계시공"})
|
||||
lines = _all_lines(got)
|
||||
blank = [x for x in lines if x["금액"] is None]
|
||||
assert blank and all(x["이름글"] and x["조각"] for x in blank)
|
||||
assert len(blank) < len(lines) or got["계"] is not None
|
||||
calc = store.calc("GC001000", {**store.auto("GC001000")["값"], "시공구분": "기계시공"})
|
||||
assert got["계"] == calc["sums"]["계"]
|
||||
|
||||
Reference in New Issue
Block a user