# -*- coding: utf-8 -*- """공용 표 양식(PLAN 70-1) 회귀검증 — 묶음 머리 · 고정 열 · 숫자 꼴 · 빈 값 · 합계 · 1,000줄. Node 헬퍼(`helper_ui_data_table.cjs`)가 `ui_template/ui_template_data_table.ts` 를 트랜스파일해 견본(`fixture_data_table_sample.js` · 머리 3줄 · 30열 · 66줄)으로 HTML 을 만들고, 여기서 판정함. """ import json import os import subprocess import pytest HERE = os.path.dirname(os.path.abspath(__file__)) @pytest.fixture(scope="module") def r(): proc = subprocess.run( ["node", os.path.join(HERE, "helper_ui_data_table.cjs")], capture_output=True, text=True, encoding="utf-8", timeout=60, ) assert proc.returncode == 0, proc.stderr return json.loads(proc.stdout) def test_견본_크기(r): assert r["cols"] == 30 assert r["headRows"] == 3 assert r["bodyRows"] == 66 def test_묶음_머리_합침(r): first = r["firstHeadRow"] # 측점 · 거리 · 유용토 등 묶음 없는 열은 머리 3줄을 세로로 차지 assert 'rowspan="3" class="is-frozen is-edge" style="left:0px" title="측점">측점' in first assert first.count('rowspan="3"') == 5 # 측점 거리 유용토 차인토량 누가토량 assert 'colspan="13">절토' in first # 토사 · 연암 · 측구파기 토사 · 암 각 3 + 보정량계 assert 'colspan="4">면고르기' in first assert 'colspan="2">노면정리' in first second = r["secondHeadRow"] assert 'colspan="3">토사' in second and 'colspan="3">연암' in second assert 'rowspan="2" data-num="" title="보정량계"' in second # 한 단 묶음은 머리 2줄 def test_고정_열과_숫자_칸(r): row = r["firstBodyRow"] assert row.startswith('