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"]["계"]