- 고치기 전 공통 칸(측구 상단폭 · 횡단경사)이 토사 값과 다른 그룹 값을 라벨 끝 작은 글로(「암 0.69」 · 「암 3 %」) - 칸을 고치면 한 벌로 펼쳐져 글 사라짐 · 글자색 --color-text-muted · 줄 수 그대로 - 로케일 새 키 둘(끝에 더함) · 시험 test_364_6_std_panel_same_value.py 8 · 관련 17 · typecheck Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TteK8mfYZetk5P3bEZkyVZ
97 lines
3.1 KiB
Python
97 lines
3.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""364-6 — 편집 없이 B06 를 열어도 B05 와 같은 누가토량.
|
|
|
|
까닭: B06 표준 횡단 칸이 열릴 때 공통 칸을 토사 값으로 펼쳐 암 측구 상폭 0.69 → 0.9 ·
|
|
암 횡단경사 3 → 3~5 로 세션을 고쳤음 → 다시 셈이 그 값으로 절토를 키움(성토 그대로).
|
|
못박는 것
|
|
- 브라우저 다시 셈(칸 없음 = B05) = 서버 저장 면적.
|
|
- 칸 열림(B06) 뒤 다시 셈 = B05 값 · 세션 표준 횡단 = 서버가 쓴 값 그대로.
|
|
- 저장 표준 횡단이 세션에 먼저 채워진 길도 같음.
|
|
|
|
Node 헬퍼 `helper_364_6_std_panel.mjs` 가 vite ssr 로 묶은 진짜 모듈(`helper_364_6_entry.ts`)을 부름.
|
|
"""
|
|
|
|
import json
|
|
import shutil
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
ROOT = HERE.parents[1]
|
|
FIXTURE = HERE / "fixtures" / "b06_364_6_rock_route_304.json"
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def out(tmp_path_factory):
|
|
work = tmp_path_factory.mktemp("b364_6")
|
|
build = subprocess.run(
|
|
[
|
|
"node",
|
|
str(ROOT / "config" / "node_modules" / "vite" / "bin" / "vite.js"),
|
|
"build",
|
|
"--configLoader",
|
|
"runner",
|
|
"--ssr",
|
|
"../resources/tester/helper_364_6_entry.ts",
|
|
"--outDir",
|
|
str(work),
|
|
"--logLevel",
|
|
"error",
|
|
],
|
|
cwd=ROOT,
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=300,
|
|
)
|
|
assert build.returncode == 0, build.stderr
|
|
bundle = work / "bundle.mjs"
|
|
shutil.copy(work / "helper_364_6_entry.js", bundle)
|
|
proc = subprocess.run(
|
|
["node", str(HERE / "helper_364_6_std_panel.mjs"), str(bundle), str(FIXTURE)],
|
|
cwd=ROOT,
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=120,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def _close(a: list, b: list) -> bool:
|
|
return all(abs((x[k] or 0) - (y[k] or 0)) < 1e-6 for x, y in zip(a, b, strict=True) for k in x)
|
|
|
|
|
|
def test_고정_자료는_암_측구가_토사와_다름(out):
|
|
std = out["standard"]
|
|
assert std["rock"]["ditch"]["top_width_m"] != std["soil"]["ditch"]["top_width_m"]
|
|
|
|
|
|
def test_B05_다시_셈은_서버_면적(out):
|
|
assert _close(out["config"]["b05"], out["server"])
|
|
|
|
|
|
@pytest.mark.parametrize("case", ["config", "stored"])
|
|
def test_B06_칸_열어도_B05_값(case, out):
|
|
assert _close(out[case]["b06"], out[case]["b05"])
|
|
|
|
|
|
@pytest.mark.parametrize("case", ["config", "stored"])
|
|
def test_칸_열기는_표준_횡단을_안_고침(case, out):
|
|
assert out[case]["session"] == out["standard"]
|
|
|
|
|
|
def test_고치기_전_공통_칸_끝에_암_값(out):
|
|
before = out["notes"]["before"]
|
|
assert before["B06_Std_Field_DitchTop"] == "암 0.69"
|
|
assert before["B06_Std_Field_CrossSlopeMax"] == "암 3 %"
|
|
assert before["B06_Std_Field_CrossSlopeMin"] == ""
|
|
assert before["B06_Std_Field_CutSlope"] == "" # 암은 자기 칸 · 포장은 같은 값
|
|
|
|
|
|
def test_고친_뒤_끝_글_없음(out):
|
|
assert set(out["notes"]["after"].values()) == {""}
|