feat(794-2b): 근거 제안 까닭 「판 차이」에 판 번호 · 둘 이상 파일 같은 배 = 「판 차이 강함」

- M02_San_Basis_Check 새 함수 edition · strong(causes 안 고침 · 셈 · 단 · 꼴 그대로) — 블록 판 = 글 속 「20xx년 품셈」 › 파일 이름 연도 · 기초 로직 줄 「개정」 가운데 그 뒤 것 → 근거후보 덧칸 `판` · 까닭 「판 차이('24 보완 · 파일 2024)」
- 같은 기초 · 같은 배(±2 %)가 같은 폴더 다른 HP 저장본에도 판 표지와 함께 있으면 판 차이 · 현장 값 · 그 밖 → 「판 차이 강함(…)」(읽을 때 · 저장본 안 고침)
- M02_San_Basis_Store — one 끝 edition(HP 파일 이름) · listing · block 끝 strong · 저장본 VERSION 794-2b.1
- 지킴 시험 test_794_2b_edition 7 — 개정 칸 = 빌더 값 · 셈 지문 건너뜀 없음 · 잔토처리 ㎥당 보통인부 0.2 · 봉화#98 철근공 ×0.9714 「판 차이('24 보완 · 파일 2024)」 · 봉화#8 · 거창#28 뒤채움 ×1.98 판 차이 강함

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-05 19:42:34 +09:00
co-authored by Claude Opus 5.5
parent e1a1db7797
commit 616dfa698a
3 changed files with 249 additions and 3 deletions
+129
View File
@@ -0,0 +1,129 @@
"""794-2b 지킴 — 품셈 판 표지 · 잔토처리 단독 GC.
① 로직 줄 칸 「개정」 = 빌더(`build_로직_개정.py`)가 원문 절 머리에서 뽑은 값과 같음 · 채움 수.
② 셈 값 그대로 — 791-1 지문 fixture 가 지금 마스터 지문(건너뜀 없이 1,515 전후 같음을 돎).
③ 근거 제안 까닭 판 번호 — 봉화#98 철근 현장조립 3.5 ↔ 3.4 = 「판 차이('24 보완 · 파일 2024)」 ·
거창#28 · 봉화#8 뒤채움 같은 배 ×1.98 = 「판 차이 강함」(엑셀 = `helper_m02_hopyo_golden.FILES`).
④ 잔토처리(인력) GC001194 = ㎥당 보통인부 0.2 인(건설 공통 3-2-1 비고).
"""
import importlib
import json
import helper_m02_hopyo_golden as golden
import pytest
from M01_MasterData import M01_MasterData_Store as m01 # scripts 길을 둠
from M02_MasterTemplete import M02_San_Basis_Check as chk
from M02_MasterTemplete import M02_San_Basis_Store as store
from M02_MasterTemplete import M02_San_Book as san_book
rev = importlib.import_module("build_로직_개정")
mf = importlib.import_module("master_formula")
fp = importlib.import_module("test_791_1_engine_semantics")
def _rows() -> dict:
files, _ = m01.loaded()
return {r["키"]: r for d in files.values() if d.get("그룹") == "로직" for r in d["줄"]}
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"])
assert cols.index("개정") == cols.index("출처") + 1 # _틀.md 7 장 열 차례
def test_셈_지문_건너뜀_없음():
saved = json.loads(fp.FINGER.read_text(encoding="utf-8"))
assert saved["마스터"] == fp._master_hash()
assert len(saved["결과"]) >= 1516
def test_잔토처리_단독():
_, whole = m01.loaded()
row = _rows()["GC001194"]
assert (row["원문번호"], row["결과단위"]) == ("3-2-1", "원/㎥")
raw = mf.run(whole, "GC001194", {})
(line,) = raw["줄"]
assert (line["이름"], float(line["수량"])) == ("보통인부", 0.2)
def test_연도_읽기():
assert [chk.file_year(p.name) for p in golden.FILES.values()] == [
2026,
2026,
2025,
2024,
2024,
2024,
2025,
2025,
]
assert chk.text_year({"글": ["2017년 품셈 6-3-1"]}) == 2017
assert chk.text_year({"글": ["「24년 건설표준품셈 6-2-3」"]}) == 2024
assert chk.text_year({"글": ["건설표준품셈 6-2(철근) 적용"]}) is None
assert chk.edition_tag("GC000207", [2008, 2014, 2022, 2024], 2024, "파일") == (
"'24 보완 · 파일 2024"
)
assert chk.edition_tag("GC000211", [2017, 2018], 2017, "글") == "'18 보완 · 글 2017"
assert chk.edition_tag("GF000123", [2026], 2026, "글") == ""
def test_판_차이_강함_틀():
a = {
"1": {
"근거후보": [
{
"기초": "GC1",
"판": "'25 보완 · 파일 2024",
"까닭": [["그 밖", "보통인부 ×1.98"], ["단위 기준 차이", "x ×10"]],
}
]
}
}
b = {
"9": {
"근거후보": [
{"기초": "GC1", "판": "'25 보완 · 파일 2025", "까닭": [["그 밖", "보통인부 ×1.99"]]}
]
}
}
got = chk.strong(a, [b])["1"]["근거후보"][0]["까닭"]
assert got == [
["판 차이 강함('25 보완 · 파일 2024)", "보통인부 ×1.98"],
["단위 기준 차이", "x ×10"],
]
assert chk.strong(a, [])["1"]["근거후보"][0]["까닭"][0][0] == "그 밖"
assert a["1"]["근거후보"][0]["까닭"][0][0] == "그 밖" # 저장본 안 고침
def _one(tag: str, no: int) -> dict:
path = golden.FILES[tag]
book = golden.read(tag) if path.exists() else None
if book is None:
pytest.skip(f"실무 엑셀 없음 {tag}")
sheets = san_book.sheets(path.name, path.read_bytes()) if book["꼴"] == "STmate" else {}
book = {**book, "숨은식": store.hidden(book, sheets), "파일": path.name}
return store.one(book, no)
def test_봉화98_판_번호():
got = {c["기초"]: c for c in _one("봉화", 98)["근거후보"]}
c = got["GC000207"]
assert c["단"] == "근접" and c["판"] == "'24 보완 · 파일 2024"
assert ["판 차이('24 보완 · 파일 2024)", "철근공 ×0.9714"] in c["까닭"]
def test_뒤채움_두_파일_판_차이_강함():
a, b = _one("봉화", 8), _one("거창", 28)
marks = [
lab for c in chk.strong({"8": a}, [{"28": b}])["8"]["근거후보"] for lab, _ in c["까닭"]
]
assert "판 차이 강함('25 보완 · 파일 2024)" in marks