feat(D01·D04): 예정노선 측점 표기 No.+거리(61+14.5 꼴) — D01 입력 옆 표기 · D04 표 · xlsx 측점 칸
- D01 시작 · 종료 칸 이름 측점 말로 · 입력 옆 즉시 `= 61+14.5` (저장값 m 그대로) - D04 표 측점 열 · xlsx 시점 · 종점 측점 칸 덧(m 칸 · shp 숫자 칸 유지) - 파이썬 station_label ↔ stationLabel 거울 시험 · 도움말 D01 · D04 글 · 그림 열여섯 장 다시 찍음 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -160,6 +160,13 @@ def test_zip_and_coordinate_table():
|
||||
sheet = load_workbook(io.BytesIO(bundle.all["좌표표_시험 프로젝트.xlsx"])).active
|
||||
rows = list(sheet.iter_rows(min_row=3, values_only=True))
|
||||
assert [r[0] for r in rows] == [2026, 2027]
|
||||
head = [c.value for c in next(sheet.iter_rows(min_row=2, max_row=2))]
|
||||
assert head[9:11] == ["시점 측점", "종점 측점"] and head[11:13] == [
|
||||
"시점누가(m)",
|
||||
"종점누가(m)",
|
||||
]
|
||||
# 100 m → 5+0 · m 칸은 그대로
|
||||
assert rows[0][9] == "5+0" and rows[0][11] == pytest.approx(100.0)
|
||||
# 업체용 좌표표는 그 연도만
|
||||
one = load_workbook(io.BytesIO(bundle.by_year[2026]["좌표표_시험 프로젝트.xlsx"])).active
|
||||
assert [r[0] for r in one.iter_rows(min_row=3, values_only=True)] == [2026]
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""545-1 측점 표기 거울 — D04 `station_label`(py) ↔ `common_util_station.ts` `stationLabel(…, 1)`."""
|
||||
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
||||
if str(PROJECT_ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(PROJECT_ROOT))
|
||||
|
||||
from D04_PlanConfirm.D04_PlanConfirm_Export import station_label # noqa: E402
|
||||
|
||||
TS = PROJECT_ROOT / "common_util" / "common_util_station.ts"
|
||||
TYPESCRIPT = PROJECT_ROOT / "config" / "node_modules" / "typescript"
|
||||
VALUES = [
|
||||
0,
|
||||
19.96,
|
||||
20,
|
||||
39.99,
|
||||
100,
|
||||
1234.5,
|
||||
1234.56,
|
||||
1234.44,
|
||||
1234.05,
|
||||
1234.95,
|
||||
61 * 20 + 14.5,
|
||||
812.345,
|
||||
]
|
||||
|
||||
SCRIPT = r"""
|
||||
const ts = require(process.argv[1]);
|
||||
const src = require("fs").readFileSync(process.argv[2], "utf8");
|
||||
const js = ts.transpileModule(src, { compilerOptions: { module: ts.ModuleKind.CommonJS } }).outputText;
|
||||
const box = { exports: {} };
|
||||
new Function("exports", "module", js)(box.exports, box);
|
||||
process.stdout.write(JSON.stringify(JSON.parse(process.argv[3]).map((v) => box.exports.stationLabel(v, 20, 1))));
|
||||
"""
|
||||
|
||||
|
||||
def test_파이썬과_TS_측점_표기_같음():
|
||||
proc = subprocess.run(
|
||||
["node", "-e", SCRIPT, str(TYPESCRIPT), str(TS), json.dumps(VALUES)],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
encoding="utf-8",
|
||||
timeout=60,
|
||||
)
|
||||
assert proc.returncode == 0, proc.stderr
|
||||
assert json.loads(proc.stdout) == [station_label(v) for v in VALUES]
|
||||
|
||||
|
||||
def test_표기_꼴():
|
||||
assert station_label(1234.5) == "61+14.5"
|
||||
assert station_label(0) == "0+0"
|
||||
assert station_label(39.99) == "2+0"
|
||||
Reference in New Issue
Block a user