Files
Aislo/resources/tester/table_migration_check.py
T
eomsangdonandClaude Opus 5 0ef32b5279 chore(tester): 시험을 resources/tester/ 로 옮김 — 창끼리 건너가게
⚠ **뿌리** — `tmp/` 는 창 사이에 안 건너감(실측 확인: 상대 창이 놓은 `tmp/_sync_probe.txt`
가 시간을 두고 두 번 봐도 안 보임). 그래서 **정본(등록부 스키마)만 건너가고 그것을 읽는
시험은 안 건너가** 오늘 두 번, 같은 시험이 **연 창은 통과·받은 창은 실패**가 됐음.

- `tmp/tests/*` 를 `resources/tester/` 로 **복사**(127 파일). 내용은 **한 줄도 안 고침**
- `tmp/tests` 는 **남겨 둠** — 되돌릴 자리(사용자 지시)
- 실행: `./venv/Scripts/python.exe -m pytest resources/tester/ -q`
  옮기기 전과 **같은 수**: 617 통과 / 22 건너뜀 / 실패 0

⇒ 이제 시험·예외·까닭이 **정본과 함께** 움직임. 오늘 세운 「예외는 정본 스키마에」와 짝임.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-09 17:12:30 +09:00

45 lines
2.0 KiB
Python

"""이관한 표가 예전 선·문자 그림과 같은 자리를 그리는지 확인 (수동 실행)."""
import sys
sys.path.insert(0, ".")
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_Table import (
_cross_table_entities,
extract_quantity_table,
QUANTITY_VALUE_KEYS,
cross_table_height,
cross_table_width,
)
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_Basin import _info_box_entities
qt = {key: float(index + 1) for index, key in enumerate(QUANTITY_VALUE_KEYS)}
entities = _cross_table_entities("draw1", qt, 0.0, "No.10", center_x=0.0)
assert len(entities) == 1 and entities[0]["type"] == "Table", entities
shape = entities[0]["shapeData"]
widths = shape["columnWidths"]
heights = shape["rowHeights"]
print("cross columns:", len(widths), "rows:", len(heights))
print("width:", round(sum(widths), 6), "expected:", cross_table_width())
print("height:", round(sum(heights), 6), "expected:", cross_table_height())
print("origin:", shape["origin"])
titles = [c for row in shape["cells"] for c in row if c and c.get("colSpan", 1) == len(widths)]
print("title cell:", titles[0]["text"], "align", titles[0]["align"])
keyed = {c["key"]: c["text"] for row in shape["cells"] for c in row if c and c.get("key")}
print("keyed cells:", len(keyed), "of", len(QUANTITY_VALUE_KEYS))
missing = [k for k in QUANTITY_VALUE_KEYS if k not in keyed and k not in ("cut", "fill")]
print("missing keys:", missing)
back = extract_quantity_table("draw1", {"entities": entities})
same = all(
back.get(k) == qt[k] for k in QUANTITY_VALUE_KEYS if k not in ("cut", "fill")
)
print("round-trip values equal:", same)
box = _info_box_entities("draw1", 1, {"chainage_m": 100.0, "area_m2": 12345.0,
"relief_m": 12.0, "flow_length_m": 34.0}, "#fff",
(0.0, 0.0), 20.0)
assert len(box) == 1 and box[0]["type"] == "Table"
bs = box[0]["shapeData"]
print("basin columns:", bs["columnWidths"], "rows:", len(bs["rowHeights"]))
print("basin cells:", [[c["text"] if c else None for c in row] for row in bs["cells"]])