diff --git a/M02_MasterTemplete/M02_San_Link.py b/M02_MasterTemplete/M02_San_Link.py index 986f4e0b2..747d0115c 100644 --- a/M02_MasterTemplete/M02_San_Link.py +++ b/M02_MasterTemplete/M02_San_Link.py @@ -114,7 +114,8 @@ def hourly_text(key: str | None) -> str | None: got = dim.hourly_link(key, "노무비") if not got: return None - return f"로직({got['키']}{''.join(f', {k}={v}' for k, v in got['입력'].items())})" + args = "".join(f", {dim._q(k)}={v}" for k, v in got["입력"].items()) # 빈칸 든 이름은 따옴표 + return f"로직({got['키']}{args})" def combo_link(one: dict, parts: list[dict]) -> str | None: diff --git a/resources/tester/test_820_1_small_machines.py b/resources/tester/test_820_1_small_machines.py index 24c11c887..5c5b01eae 100644 --- a/resources/tester/test_820_1_small_machines.py +++ b/resources/tester/test_820_1_small_machines.py @@ -151,3 +151,23 @@ def test_other_docs_same() -> None: assert pick[0] not in codes, row["키"] old = [k for k, r in _eq().items() if k not in NEW] assert not [k for k in old if str(_eq()[k].get("원문번호") or "").startswith("자체 ")] + + +def test_blank_input_name_link_roundtrip() -> None: + """820-2 — 빈칸 든 입력 이름(「전력 계약종별」)이 이음 글 → 읽기 왕복 · EST main 504 번 = 저장 금액 · 우리 단가 셈.""" + from M02_MasterTemplete import M02_San_Link as sl + from M02_MasterTemplete import M02_Sangeun_Imported as imp + + text = sl.hourly_text("EQ000662") + assert "'전력 계약종별'=" in text + node = di.dc.cv.mf.parse(text) + assert node[0] == "logic" and "전력 계약종별" in [k for k, _ in node[2]] + assert imp._link(text, "로직", "시험", imp._whole()) == text + import test_810_2_native_doc as t + + out = t.fn.emit(t.native("EST", "main"), 504) + sk, _, got = t.doc_and_money(out) + assert float(got["계"]) == 546 # 원파일 저장 금액 + sk[imp.KEY]["단가기준"] = "우리" + ours = di.run(di.derive(sk, None, t.whole()), sk, t.whole()) + assert ours.get("셈됨") is not False and ours["계"] is not None