From a9199550d9216180766dc7fd8087ed921b623015 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Thu, 24 Sep 2026 12:13:34 +0900 Subject: [PATCH] =?UTF-8?q?fix(m01):=20=ED=91=9C=20=EC=A1=B0=EA=B0=81=20?= =?UTF-8?q?=EC=B0=B8=EC=A1=B0=EC=97=90=20=EC=A4=84=20=3D=20=EC=97=94?= =?UTF-8?q?=EC=A7=84=EC=9D=B4=20=EC=B0=BE=EC=9D=80=20=EC=A4=84=20=EC=B0=A8?= =?UTF-8?q?=EB=A1=80=20(PLAN=205=EC=9E=A5=206=EB=B0=94=ED=80=B4=20?= =?UTF-8?q?=EC=84=9C=EB=B2=84)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - find 가 고른 줄의 차례(그 표 줄 배열 · 0부터)를 참조.줄 로 더함 - 줄에 없는 조건 칸은 맞음으로 보는 엔진 규칙을 화면이 흉내 내지 않게 - 시험: GC000010 크레인 줄 · GF000160 합판 줄 · 금액 변화 0 Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01V1MKKZKpUHTPKb513FneU8 --- resources/master_data/scripts/master_text.py | 3 ++- resources/tester/test_m01_text.py | 22 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/resources/master_data/scripts/master_text.py b/resources/master_data/scripts/master_text.py index d20ce613..d455f44d 100644 --- a/resources/master_data/scripts/master_text.py +++ b/resources/master_data/scripts/master_text.py @@ -209,7 +209,8 @@ def _alias_piece(mark: dict, env: dict, master, column: str | None) -> dict: row = mf.find(table, conds, column) tail = column.rpartition("_")[2] if column else "" piece["글"] = " · ".join([*_row_label(table, row, conds), *([tail] if tail else [])]) - piece["참조"] = {"테이블": ref[:2], "키": ref, "행": conds, "열": column} + at = next(i for i, one in enumerate(table["줄"]) if one is row) # find 가 고른 줄 + piece["참조"] = {"테이블": ref[:2], "키": ref, "행": conds, "열": column, "줄": at} else: piece["참조"] = {"테이블": ref[:2], "키": ref} except _CALC_ERRORS: diff --git a/resources/tester/test_m01_text.py b/resources/tester/test_m01_text.py index e6bc33ef..4a2f1e9c 100644 --- a/resources/tester/test_m01_text.py +++ b/resources/tester/test_m01_text.py @@ -308,6 +308,28 @@ def test_조각_로직_부르는_줄_990개_세_비목에_다_걸치고_계산_ assert [g["소계"] for g in out["groups"]] == [None] +def test_표_조각_참조_줄은_엔진이_찾은_줄의_차례다() -> None: + """GC000010 크레인 — 줄에 없는 조건 칸은 맞음이라 흉내 내면 틀림 · GF000160 합판도.""" + files = store.cm.load(folder=REAL) + master = store.cm.master(REAL) + for key in ("GC000010", "GF000160"): + got = mt.lines(files, key, dict(store.cm.시험입력(master.logic(key)))) + tables = [p for one in _all_lines(got) for p in one["조각"] if p["kind"] == "표"] + assert tables and all("줄" in p["참조"] for p in tables), key + for p in tables: + rows = master.get(p["참조"]["키"])["줄"] + hit = rows[p["참조"]["줄"]] + assert hit is mt.mf.find(master.get(p["참조"]["키"]), p["참조"]["행"], p["참조"]["열"]) + got = mt.lines(files, "GC000010", dict(store.cm.시험입력(master.logic("GC000010")))) + pill = next( + p + for one in _all_lines(got) + for p in one["조각"] + if p["kind"] == "표" and p["참조"]["키"] == "QC000031" and "크레인" in p["글"] + ) + assert master.get("QC000031")["줄"][pill["참조"]["줄"]]["구분"] == "크레인" + + def test_합판거푸집_표_조각_글은_줄마다_다르고_참조에_찾기_조건이_있다(client: TestClient) -> None: """PLAN 3-3 — 글 = 「찾은 줄 · 칸」 · 참조.행 = 찾기 조건 · 중간 값은 글에 이름.""" got, _ = _both(client, FORM)