From fdd8f023d3be21ed659838705e12011b8f9ad67c Mon Sep 17 00:00:00 2001 From: umsangdon Date: Wed, 18 Nov 2026 10:56:52 +0900 Subject: [PATCH] =?UTF-8?q?test(855-E=20L3=20=EB=AF=B8=EB=A6=AC):=20M01=20?= =?UTF-8?q?=EB=B3=84=EC=B9=AD=20=C2=B7=20=EC=B6=9C=EC=B2=98=20=C2=B7=20?= =?UTF-8?q?=ED=91=9C=EC=A4=80=20=EB=AA=A9=EB=A1=9D=20=C2=B7=20=EB=8F=88=20?= =?UTF-8?q?=EC=95=84=EB=8B=8C=20=EA=B8=B0=EC=B4=88=20=C2=B7=20SK=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94=20=EA=B2=AC=EB=B3=B8=EC=9D=84=20?= =?UTF-8?q?=EC=88=98=EC=8B=9D=20=EB=AC=B8=EC=84=9C=EB=A1=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 로직 JSON 없는 판에서 깨지거나 빈 채로 통과하던 「시험이 로직 파일 · 줄을 견본으로 읽음」 둘째 묶음. - test_208_1 별칭 왕복 — 저장 확인 · 정본 안 건드림 = 수식 문서 파일(별칭 정본 = 문서 머리) - test_704_logic_standard 석축 · 측구파기 찾기 — 기초 줄 = M01 수식 문서 - test_m01_logic_source 출처 셋 — 정본 기초 출처 = 수식 문서 파일(마크다운 벗김은 없는 판에서 0 건 빈 통과였음 → 본 수 > 1000) - test_728_2 돈 아닌 기초 65 — 기초 = 수식 문서 · 표 = M01 색인 - test_792_1 [초기화] · 같은 내용 견본 입력 — 로직 줄 「시험입력」(버림 칸) → 문서 변수 기본값 지금 판 · 없는 판 둘 다 통과(792-1 이름 꼴 ↔ 엔진 식 하나 = 옛 식 언어 · 2-E4 몫) · 관련 12 파일 105 통과 Co-Authored-By: Claude Opus 5.5 --- resources/tester/test_208_1_logic_alias.py | 10 +++++----- resources/tester/test_704_logic_standard.py | 10 ++-------- resources/tester/test_728_2_sk_unit.py | 8 +++++--- resources/tester/test_792_1_sangeun_formula.py | 8 +++++++- resources/tester/test_m01_logic_source.py | 15 ++++++++------- 5 files changed, 27 insertions(+), 24 deletions(-) diff --git a/resources/tester/test_208_1_logic_alias.py b/resources/tester/test_208_1_logic_alias.py index 47f022a47..a0e5b27d0 100644 --- a/resources/tester/test_208_1_logic_alias.py +++ b/resources/tester/test_208_1_logic_alias.py @@ -24,7 +24,7 @@ from M01_MasterData.M01_MasterData_Store_Find import hit ROOT = Path(__file__).resolve().parents[2] REAL = store.FOLDER LOGIC_KEY = "GC000091" # 공통 3-3-1 암발파(미진동굴착 TYPE-Ⅰ) -LOGIC_FILE = "로직_건설품셈_03장_토공사.json" +DOC_FILE = "수식문서/수식_건설품셈_03장_토공사.json" # 별칭 정본 = 수식 문서 머리(855 L1) ROW = { "키": "GF000001", @@ -127,7 +127,7 @@ def _save(client: TestClient, row: dict) -> None: def test_읽기_빈칸_저장_왕복_임시_사본만(client: TestClient) -> None: - real = (REAL / LOGIC_FILE).read_bytes() + real = (REAL / DOC_FILE).read_bytes() listed = _logics(client) assert listed and all(isinstance(x["별칭"], str) for x in listed) # 없으면 빈칸 one = client.get("/api/m01/logic", params={"key": LOGIC_KEY}).json() @@ -140,14 +140,14 @@ def test_읽기_빈칸_저장_왕복_임시_사본만(client: TestClient) -> Non assert LOGIC_KEY in [x["키"] for x in _logics(client, q="미진동 발파")] found = client.get("/api/m01/elements", params={"group": "로직", "q": "암깨기"}).json() assert [x["별칭"] for x in found["items"] if x["ref"] == LOGIC_KEY] == ["미진동 발파, 암깨기"] - saved = json.loads((store.FOLDER / LOGIC_FILE).read_text(encoding="utf-8")) + saved = json.loads((store.FOLDER / DOC_FILE).read_text(encoding="utf-8")) assert next(r for r in saved["줄"] if r["키"] == LOGIC_KEY)["별칭"] == "미진동 발파, 암깨기" _save(client, base) # 지우면 칸째 빠짐 · 찾기에도 안 걸림 assert LOGIC_KEY not in [x["키"] for x in _logics(client, q="암깨기")] - after = json.loads((store.FOLDER / LOGIC_FILE).read_text(encoding="utf-8")) + after = json.loads((store.FOLDER / DOC_FILE).read_text(encoding="utf-8")) assert after == json.loads(real.decode("utf-8")) # 왕복 뒤 내용 그대로 - assert (REAL / LOGIC_FILE).read_bytes() == real # 정본은 안 건드림 + assert (REAL / DOC_FILE).read_bytes() == real # 정본은 안 건드림 def _src(rel: str) -> str: diff --git a/resources/tester/test_704_logic_standard.py b/resources/tester/test_704_logic_standard.py index 974face24..8a3831f3e 100644 --- a/resources/tester/test_704_logic_standard.py +++ b/resources/tester/test_704_logic_standard.py @@ -70,8 +70,7 @@ def test_대표_규격_펼침() -> None: def test_석축_찾으면_쌓기() -> None: hits = [ r["이름"] - for _, data in m01._logic_files(m01.loaded()[0]) - for logic in data.get("줄") or [] + for logic in m01_doc.docs().values() # 기초 = 수식 문서(855 L3) for r in [{**logic, "별칭": ", ".join(st.words_of(logic))}] if hit(r, "석축") ] @@ -135,11 +134,6 @@ def test_화면_기준_목록_계산서_담기() -> None: def test_내역서_낱말_측구파기로_측구터파기를_찾음() -> None: - logic = next( - logic - for _, data in m01._logic_files(m01.loaded()[0]) - for logic in data.get("줄") or [] - if logic.get("키") == "GF000099" # 9-12-1 측구터파기 토사 - ) + logic = m01_doc.docs()["GF000099"] # 9-12-1 측구터파기 토사 row = {**logic, "별칭": ", ".join(st.words_of(logic))} assert hit(row, "측구파기") diff --git a/resources/tester/test_728_2_sk_unit.py b/resources/tester/test_728_2_sk_unit.py index 5147b5249..3e7f6330c 100644 --- a/resources/tester/test_728_2_sk_unit.py +++ b/resources/tester/test_728_2_sk_unit.py @@ -75,11 +75,13 @@ def test_식_빈_단위는_옛_셈(whole): def test_돈_아닌_기초_고르기_창에서_뺌(whole): + from M01_MasterData import M01_MasterData_Doc as m01_doc + + rows = [*m01_doc.docs().values()] # 기초 = 수식 문서(855 L3) · 표 = M01 색인 + rows += [r for tid in ("QC", "QF") for r in whole.index.get(tid, {}).values()] money = [ r - for tid, d in whole.index.items() - if tid in ("GC", "GF", "QC", "QF") - for r in d.values() + for r in rows if isinstance(r, dict) and "결과단위" in r and not str(r["결과단위"]).strip().startswith("원") diff --git a/resources/tester/test_792_1_sangeun_formula.py b/resources/tester/test_792_1_sangeun_formula.py index e6dc28b7a..a1f56d227 100644 --- a/resources/tester/test_792_1_sangeun_formula.py +++ b/resources/tester/test_792_1_sangeun_formula.py @@ -29,7 +29,13 @@ def _whole(): def _carry(): - base = json.loads(json.dumps(_whole().logic(CARRY)["시험입력"], default=str)) + import importlib + + from M01_MasterData import M01_MasterData_Doc as m01_doc + + doc = m01_doc.docs()[CARRY] # 기본 입력 = 수식 문서 변수 기본값(855 L3) + given = importlib.import_module("master_doc_work").defaults(doc, None) + base = json.loads(json.dumps(given, default=str)) return {**base, "재료종별": "암석", "재료형상": "화강암", "운반회수": 0} diff --git a/resources/tester/test_m01_logic_source.py b/resources/tester/test_m01_logic_source.py index 2d7da25d8..cca164480 100644 --- a/resources/tester/test_m01_logic_source.py +++ b/resources/tester/test_m01_logic_source.py @@ -7,8 +7,8 @@ import json from fastapi import FastAPI from fastapi.testclient import TestClient +from M01_MasterData import M01_MasterData_Doc as doc_store from M01_MasterData import M01_MasterData_Router as router_module -from M01_MasterData import M01_MasterData_Store as store from M01_MasterData import M01_MasterData_Store_Make as make @@ -39,9 +39,9 @@ def test_no_link() -> None: def test_most_master_logics_link() -> None: - """정본 로직 출처 대부분이 원문 절에 닿음.""" + """정본 기초(수식 문서) 출처 대부분이 원문 절에 닿음.""" hit = total = 0 - for path in store.FOLDER.glob("로직_*품셈_*.json"): + for path in doc_store.folder().glob("수식_*품셈_*.json"): for row in json.loads(path.read_text(encoding="utf-8"))["줄"]: total += 1 hit += bool(make.source(row.get("출처", ""))["found"]) @@ -65,14 +65,15 @@ def test_tables_split_and_br() -> None: def test_markdown_stripped() -> None: """역슬래시 · 인용 `>` 머리 · 글 안 주석을 벗김(50-2) — 모든 정본 출처 원문에 0.""" - bad = 0 - for path in store.FOLDER.glob("로직_*품셈_*.json"): + bad = seen = 0 + for path in doc_store.folder().glob("수식_*품셈_*.json"): for row in json.loads(path.read_text(encoding="utf-8"))["줄"]: for one in make.source(row.get("출처", ""))["found"]: for b in one["blocks"]: t = b.get("p") or b.get("text") or "" + seen += 1 bad += "\\" in t or "