fix(m01-sl): 가져온 표 블록 칸 차례를 정함대로 — 값 칸 범위도 아래 · 위 두 칸 · 숫자 하나면 두 칸에 같은 수

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BU9gbNE3aWFUvE61pS2WGt
This commit is contained in:
2026-10-01 13:29:16 +09:00
co-authored by Claude Opus 5.5
parent 184c66e14e
commit 46c7f8e41c
3 changed files with 49 additions and 20 deletions
+23 -1
View File
@@ -20,6 +20,7 @@ import pytest
ROOT = Path(__file__).resolve().parents[2]
IMPORT = ROOT / "M01_MasterData" / "SheetLogic" / "M01_SL_Import.ts"
PARSE = IMPORT.with_name("M01_SL_Import_Parse.ts")
pytestmark = pytest.mark.skipif(shutil.which("node") is None, reason="node 가 없음")
@@ -66,7 +67,8 @@ def _node(body: str, payload: object) -> object:
"import { readFileSync } from 'node:fs';\n"
f"register('data:text/javascript,' + encodeURIComponent({json.dumps(HOOKS)}));\n"
+ STUB
+ f"const I = await import({json.dumps(IMPORT.as_uri())});\n"
+ f"const I = {{ ...(await import({json.dumps(IMPORT.as_uri())})),"
f" ...(await import({json.dumps(PARSE.as_uri())})) }};\n"
"const A = JSON.parse(readFileSync(0, 'utf8'));\n"
"const out = (x) => process.stdout.write(JSON.stringify(x));\n" + body
)
@@ -275,3 +277,23 @@ def test_마스터_1469_가져오기_세기(master) -> None:
f"\n다 바뀜 {len(full)} / {len(rows)} · 못 바꾼 까닭 {sorted(reasons.items(), key=lambda x: -x[1])}"
)
assert len(full) > 1000
def test_표_블록_칸_차례_정함() -> None:
"""조건 칸 → 값 칸 · 범위(조건 「범위」 · 값 칸에 범위가 한 줄이라도)는 「이름·아래」 「이름·위」 · 숫자 하나면 두 칸에 같은 수"""
table = {
"조건": {"높이": "범위", "구분": "고르기"},
"값칸": {"증가율": "%", "단위": "글"},
"줄": [
{"높이": [3, 4], "구분": "가", "증가율": 30, "단위": "%"},
{"높이": 5, "구분": "나", "증가율": [80, 100]},
{"높이": [7.5, None], "증가율": 50},
],
}
rows = _node("out(I.tableRows(A));", table)
assert rows == [
["높이·아래", "높이·위", "구분", "증가율·아래", "증가율·위", "단위"],
[3, 4, "가", 30, 30, "%"],
[5, 5, "나", 80, 100, None],
[7.5, None, None, 50, 50, None],
]