Files
Pier_v1/Code/교각모델링앱/tools/test_okseong.py
T
ahnyongjooandClaude Sonnet 5.5 964a841de1 chore(rebar): Pier_T_rebar 작업 폴더 초기 구성 및 외부 의존 파일 통합
- Code\rebar_pipeline, review_pipeline, pier-program을 정션에서 실제 폴더로 전환
- Code\rhino_mcp 및 CLAUDE_rhino배경.md 추가, .mcp.json은 PYTHONPATH로 새 위치 사용
- pier-program 내부 .git 제거(이력은 backup\pier-program_20261028.bundle에 보관)
- worktree 가이드 반영(CLAUDE.local.md, HANDOFF.md)
- D:\Rhino-MCP 경로 참조를 새 위치로 치환

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 11:20:18 +09:00

78 lines
4.0 KiB
Python

"""Okseong P1 form test (2026-10-14), no Rhino: table reading fix, pier inputs, engine gate reports, app flow.
- 솔플레이트 TABLE read although ELEVATION TABLE rows interleave in its window (10 rows, all columns)
- reference piers unchanged (검증/open19_snapshot_after.json)
- table candidates all equal the hand-typed expected / params
- gate reports of data/옥성교P1 PASS with negatives detected
- app flow on a copy (검증/okseong_web_data): no gate blocked by an absent section, confirming every required bundle clears G1
"""
import json
import os
import shutil
import sys
from pathlib import Path
APP = Path(__file__).resolve().parents[1]
TD = APP / "검증" / "okseong_web_data"
if TD.exists():
shutil.rmtree(TD)
shutil.copytree(APP / "data" / "옥성교P1", TD / "옥성", ignore=shutil.ignore_patterns("runs", "backup", "confirm.json"))
sys.path.insert(0, str(APP))
sys.path.insert(0, str(APP / "tools"))
from engine import reader # noqa: E402
from open19_snapshot import snapshot # noqa: E402
ok = True
def check(name, cond, detail=""):
global ok
ok &= bool(cond)
print("PASS" if cond else "FAIL", name, str(detail)[:300], flush=True)
ref = json.loads((APP / "검증" / "open19_snapshot_after.json").read_text(encoding="utf-8"))
now = snapshot()
for k in ref:
check(f"{k}: table records / proposals unchanged", ref[k]["records"] == now[k]["records"]
and ref[k]["proposals"] == now[k]["proposals"])
D = APP / "data" / "옥성교P1"
texts = json.loads((D / "drawings" / "texts.json").read_text(encoding="utf-8"))
tables = reader.table_candidates(texts)
sp = [t for t in tables if t["key"] == "sole_plate"][0]
recs = [r for _, r in reader.table_records(sp["rows"], lambda s: s.isdigit())]
check("솔플레이트 TABLE 10 rows NO.1~10", [r["_key"] for r in recs] == [str(i) for i in range(1, 11)], [r["_key"] for r in recs])
check("솔플레이트 TABLE columns", recs and set(recs[0]) == {"_key", "S(%)", "L", "W", "T", "T1", "T2"}, recs[:1])
el = [t for t in tables if t["key"] == "elevation"][0]
erec = [r for _, r in reader.table_records(el["rows"], lambda s: s.isdigit())]
check("ELEVATION TABLE 10 rows", len(erec) == 10 and erec[0].get("EL.'X'") == "21.398", len(erec))
P = json.loads((D / "params.json").read_text(encoding="utf-8"))
X = json.loads((D / "expected.json").read_text(encoding="utf-8"))
rows = reader.proposals(reader.field_candidates(tables), P, X)
diff = [(r["file"], r["path"]) for r in rows if not r["same"]]
check(f"candidates all equal the typed inputs ({len(rows)} rows)", rows and not diff, diff[:5])
for g, n in (("G1", 147), ("G2", 39), ("G3", 75), ("G4", 251), ("G5", 183)): # G2 column, G3 footing, G4 coping + seats 2026-10-14
r = json.loads((D / "runs" / "current" / f"{g}_gate.json").read_text(encoding="utf-8"))
check(f"{g} gate PASS {n}/{n}, negatives detected, reload ok",
r["verdict"] == "PASS" and r["summary"]["passed"] == n == r["summary"]["total"]
and all(v["detected"] for v in r["negative"].values()) and (r["reload"]["ok"] or r.get("mode") == "batch"), r["summary"]) # batch mode (app 일괄 승인) skips save + reload on purpose (OPEN #25)
os.environ["PIERAPP_DATA"] = str(TD)
sys.path.insert(0, str(APP / "web"))
import app as webapp # noqa: E402
sys.path.insert(0, str(Path(__file__).resolve().parent))
from testlib import confirm_required # noqa: E402
import store # noqa: E402
p = store.Pier("옥성")
missing = [b for g in p.scope() for b in webapp.gate_blockers(p, g) if b.endswith("없음")]
check("no gate blocked by an absent section", not missing, missing)
c = webapp.app.test_client()
confirm_required(c, webapp, store, "옥성", "시험")
p = store.Pier("옥성")
check("confirming every required bundle clears G1", webapp.gate_blockers(p, "G1") == [], webapp.gate_blockers(p, "G1"))
check("pier page renders", c.get("/pier/옥성").status_code == 200)
shutil.rmtree(TD)
print("RESULT", "PASS" if ok else "FAIL")
sys.exit(0 if ok else 1)