From 51af428b5c1ada75caa0986e313f444df83e1b73 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Thu, 24 Sep 2026 15:18:16 +0900 Subject: [PATCH] =?UTF-8?q?fix(m01):=20/text=20=EB=8F=84=20=ED=92=80?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EC=A4=91=EA=B0=84?= =?UTF-8?q?=EA=B0=92=EC=9D=80=20=EB=B9=84=EC=9A=B0=EA=B3=A0=20=EA=B7=B8=20?= =?UTF-8?q?=EC=A4=84=EB=A7=8C=20=EA=B8=88=EC=95=A1=20=EB=B9=84=EC=9B=80=20?= =?UTF-8?q?(PLAN=206=EC=9E=A5=20=EB=84=B7=EC=A7=B8=20=EC=A4=84)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - _env_of 가 EmptyInput 을 Blank 로 받아 /calc 와 같은 빈 줄 규칙 - 멈춤(calc) 46 로직 329 조합: /text 멈춤 309 → 0 · 계는 /calc 와 같음 Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01V1MKKZKpUHTPKb513FneU8 --- resources/master_data/scripts/master_text.py | 5 ++++- resources/tester/test_m01_text.py | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/resources/master_data/scripts/master_text.py b/resources/master_data/scripts/master_text.py index 0079edd3..70d5a918 100644 --- a/resources/master_data/scripts/master_text.py +++ b/resources/master_data/scripts/master_text.py @@ -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 diff --git a/resources/tester/test_m01_text.py b/resources/tester/test_m01_text.py index fdcce7f3..fea9c4d6 100644 --- a/resources/tester/test_m01_text.py +++ b/resources/tester/test_m01_text.py @@ -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"]["계"]