test(855-E L3 미리): 금액 골든 · 바탕 기반 · 802-1 거울 · 794-2b 견본을 수식 문서로

로직 JSON 없는 판(tmp/s894/l3dry)을 돌려 찾은 「시험이 로직 줄을 견본으로 읽음」 첫 묶음.
- helper_855_engine.doc_cases — 셈 경우를 수식 문서 변수(선택 목록 · 기본값)에서 셈 · 옛 cases 와 1,521 기초 다름 0 · 차례 같음
- test_855_golden · test_855_e4a_base_only — 키 = 수식 문서 차례 · 경우 = doc_cases(없는 판에서 0 건 빈 통과였음 → 견줄 기초 0 이면 실패)
- test_802_1 ④ ⑤ — 견본 문서 = 수식 문서 정본(옛 로직 줄 변환 cv.convert 걷음)
- test_794_2b — 개정 값 · 잔토처리 단독 = 수식 문서 머리 · 문서 셈(빌더 대조 · 열 차례는 그대로 = L3 빌더 몫)
지금 판 · 없는 판 둘 다 통과(794-2b 빌더 · 옛 지문 둘은 없는 판 빨강 = L3 · 2-E4 몫) · 골든 전수 1,521 통과 · 관문 149 통과

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 10:43:09 +09:00
co-authored by Claude Opus 5.5
parent 5d3aa66393
commit 7a784f5721
5 changed files with 45 additions and 33 deletions
+15 -2
View File
@@ -54,6 +54,19 @@ def cases(row: dict, options: bool) -> list[tuple[str, dict, dict | None]]:
return out
def doc_cases(doc: dict, options: bool) -> list[tuple[str, dict | None]]:
"""(옵션 글, 새 문서에 넘길 바뀐 입력) — 수식 문서 변수(선택 목록 · 기본값)에서 · `cases` 와 같은 표본."""
out: list[tuple[str, dict | None]] = [("", None)]
if options:
for var in doc.get("변수") or []:
link = var.get("연결") or {}
if link.get("갈래") == "선택":
for opt in link.get("목록") or []:
if str(opt) != str(link.get("값")):
out.append((f"{var['열쇠']}={opt}", {var["열쇠"]: opt}))
return out
def old_run(row: dict, given: dict):
whole = world()[1]
try:
@@ -157,9 +170,9 @@ def answer(got) -> object:
}
def fingerprint(key: str, row: dict, options: bool = True) -> str:
def fingerprint(key: str, options: bool = True) -> str:
doc = world()[2][key]
got = [[label, answer(new_run(doc, changed))] for label, _, changed in cases(row, options)]
got = [[label, answer(new_run(doc, changed))] for label, changed in doc_cases(doc, options)]
raw = json.dumps(got, ensure_ascii=False, sort_keys=True)
return hashlib.sha256(raw.encode("utf-8")).hexdigest()[:16]
+16 -11
View File
@@ -1,6 +1,7 @@
"""794-2b 지킴 — 품셈 판 표지 · 잔토처리 단독 GC.
① 로직 줄 칸 「개정」 = 빌더(`build_로직_개정.py`)가 원문 절 머리에서 뽑은 값과 같음 · 채움 수.
① 로직 줄 칸 「개정」 = 빌더(`build_로직_개정.py`)가 원문 절 머리에서 뽑은 값과 같음 · 채움 수 ·
수식 문서 머리 「개정」 값(855 L1 이름표).
② 셈 값 그대로 — 791-1 지문 fixture 가 지금 마스터 지문(건너뜀 없이 1,515 전후 같음을 돎).
③ 근거 제안 까닭 판 번호 시험은 809-1 에서 지움(근거 → 기초 제안 길 걷음 · 요구 703).
④ 잔토처리(인력) GC001194 = ㎥당 보통인부 0.2 인(건설 공통 3-2-1 비고).
@@ -13,7 +14,8 @@ import json
from M01_MasterData import M01_MasterData_Store as m01 # scripts 길을 둠
rev = importlib.import_module("build_로직_개정")
mf = importlib.import_module("master_formula")
mc = importlib.import_module("master_doc_calc")
ml = importlib.import_module("master_doc_link")
fp = importlib.import_module("test_791_1_engine_semantics")
@@ -26,14 +28,17 @@ def test_개정_칸_빌더와_같음():
got = rev.build(check=True)
assert got["바뀐 파일"] == 0 # 마스터 = 빌더 값(손 입력 없음)
assert got["GC 채움"] + got["GF 채움"] >= 1237 and got["GF 빈칸"] == 0
rows = _rows()
assert rows["GC000083"]["개정"] == [2008, 2020, 2025] # 3-2-1('08, '20, 25년 보완)
assert 2024 in rows["GC000207"]["개정"] # 6-2-3 철근 현장조립 '24 보완
assert rows["GF000123"]["개정"] == [2026] # 산림 2026-01-01 제정
cols = list(rows["GC000083"])
cols = list(_rows()["GC000083"])
assert cols.index("개정") == cols.index("출처") + 1 # _틀.md 7 장 열 차례
def test_개정_칸_문서():
docs = ml.load_all()
assert docs["GC000083"]["개정"] == [2008, 2020, 2025] # 3-2-1('08, '20, 25년 보완)
assert 2024 in docs["GC000207"]["개정"] # 6-2-3 철근 현장조립 '24 보완
assert docs["GF000123"]["개정"] == [2026] # 산림 2026-01-01 제정
def test_셈_지문_건너뜀_없음():
saved = json.loads(fp.FINGER.read_text(encoding="utf-8"))
assert saved["마스터"] == fp._master_hash()
@@ -42,8 +47,8 @@ def test_셈_지문_건너뜀_없음():
def test_잔토처리_단독():
_, whole = m01.loaded()
row = _rows()["GC001194"]
assert (row["원문번호"], row["결과단위"]) == ("3-2-1", "원/㎥")
raw = mf.run(whole, "GC001194", {})
(line,) = raw["줄"]
links = ml.Links(whole)
doc = links.docs["GC001194"]
assert (doc["원문번호"], doc["결과단위"]) == ("3-2-1", "원/㎥")
(line,) = mc.calc(doc, links)["줄"]
assert (line["이름"], float(line["수량"])) == ("보통인부", 0.2)
+7 -13
View File
@@ -23,7 +23,6 @@ from M01_MasterData import M01_MasterData_Store as m01 # scripts 길을 둠
md = importlib.import_module("master_doc")
mc = importlib.import_module("master_doc_calc")
ml = importlib.import_module("master_doc_link")
cv = importlib.import_module("master_doc_convert")
HERE = os.path.dirname(os.path.abspath(__file__))
COSTS = ("노무비", "재료비", "경비", "계")
@@ -390,26 +389,21 @@ def test_정적_검사():
# ── ④ 지움 견딤 ───────────────────────────────────────────────────────
_ROWS: dict = {}
_DOCS: dict = {}
class Lazy(ml.Links):
"""M01 연결 + 부르는 문서는 그때 변환(옛 로직 → 수식 문서)."""
"""M01 연결 + 부르는 문서만 그때 담음(수식 문서 정본 — 거울 짐을 작게)."""
def doc(self, key):
try:
row = self.master.get(key)
except Exception:
return None
key = str(row["키"])
if key not in self.docs and key in _ROWS:
self.docs[key] = cv.convert(self.master, _ROWS[key])[0]
if key not in self.docs and key in _DOCS:
self.docs[key] = _DOCS[key]
return self.docs.get(key)
def _real_docs(keys):
files, whole = m01.loaded()
_ROWS.update({r["키"]: r for d in files.values() if d.get("그룹") == "로직" for r in d["줄"]})
_, whole = m01.loaded()
_DOCS.update(ml.load_all())
links = Lazy(whole, {})
return links, {key: links.doc(key) for key in keys}
@@ -534,7 +528,7 @@ def _same(a, b, where=""):
def test_거울_파이썬_TS_같은_답():
links, _ = _real_docs(())
picks = sorted(_ROWS)[::30] + list(REAL)
picks = sorted(_DOCS)[::30] + list(REAL)
for key in picks:
links.doc(key)
rec = Rec(links)
+3 -3
View File
@@ -82,10 +82,10 @@ def test_바탕_기반만으로_새_계산기_지문_골든과_같음():
import helper_855_engine as h
from helper_test_all import spread
rows, _, docs, _ = h.world()
rows = spread([r for r in rows if str(r["키"]) in docs], N)
docs = h.world()[2]
rows = spread(list(docs), N)
want = {
str(r["키"]): [[label, changed] for label, _, changed in h.cases(r, True)] for r in rows
key: [[label, changed] for label, changed in h.doc_cases(docs[key], True)] for key in rows
}
run = subprocess.run(
[sys.executable, str(Path(__file__)), "--child"],
+4 -4
View File
@@ -22,10 +22,9 @@ def current(n: int | None = None) -> dict[str, str]:
import helper_855_engine as h
from helper_test_all import spread
rows, _, docs, _ = h.world()
rows = [r for r in rows if str(r["키"]) in docs]
rows = spread(rows, n) if n else rows
return {str(r["키"]): h.fingerprint(str(r["키"]), r) for r in rows}
keys = list(h.world()[2]) # 수식 문서 차례(= 옛 로직 줄 차례)
keys = spread(keys, n) if n else keys
return {key: h.fingerprint(key) for key in keys}
def test_새_계산기_답_지문_같음():
@@ -33,6 +32,7 @@ def test_새_계산기_답_지문_같음():
want = json.loads(FILE.read_text("utf-8"))["지문"]
got = current(None if ALL else 300)
assert got, "견줄 기초 0 — 수식 문서를 못 읽음"
changed = sorted(k for k in want.keys() & got.keys() if want[k] != got[k])
gone = sorted(want.keys() - got.keys()) if ALL else []
new = sorted(got.keys() - want.keys())