Files
Aislo/resources/tester/table_migration_check.py
T
eomsangdonandClaude Opus 5 1a82df951f revert(tester): 서식만 바뀐 남의 시험 파일 25개 되돌림
ruff 글로브를 `resources/tester/*.py` 로 넓게 잡아 내 작업과 무관한 시험 파일까지
서식이 바뀌었음. 다른 창이 그 파일을 만지면 충돌만 남으므로 되돌림.
내가 실제로 고친 다섯(열쇠 장부·Z01 둘·표 읽기·못 읽은 표)만 남김.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsGw1Dz9HmhuAxGisxmDPF
2026-09-17 19:42:32 +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"]])