- 원형 마크 L = pipeLengthWhole 정수(8.5 → 9 · 8.4 → 8) · B07 짝 같은 규칙 - 거울 시험 test_265_note_cad · test_260 기대값 L=22m Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TNMXVCZXMpHpVvqmFkeChL
67 lines
2.2 KiB
Python
67 lines
2.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""PLAN 265 — B06 [상세] 표 위 CAD 칸 · 접기 · 차례 · 구조물 글 · 관 길이 정수.
|
|
|
|
- 265-3 원형 마크 L = 사사오입 정수(TS `pipeLengthWhole` = 파이썬 짝 같은 값).
|
|
|
|
./venv/Scripts/python.exe -m pytest resources/tester/test_265_note_cad.py -q
|
|
"""
|
|
|
|
import json
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
|
if str(PROJECT_ROOT) not in sys.path:
|
|
sys.path.insert(0, str(PROJECT_ROOT))
|
|
|
|
from B06_Section.B06_Section_Engine_Culvert import _culvert_set # noqa: E402
|
|
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_CulvertNote import ( # noqa: E402
|
|
culvert_note_entities,
|
|
)
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
_PIPE = {"pipe_diameter_mm": 800}
|
|
|
|
|
|
def _mirror(cases: list[dict]) -> list[dict]:
|
|
proc = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", str(HERE / "helper_260_note_cad.cjs"), "mirror"],
|
|
input=json.dumps(cases, ensure_ascii=False),
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def _labels(entities: list[dict]) -> list[str]:
|
|
return [e["shapeData"]["label"] for e in entities if e["type"] == "Text"]
|
|
|
|
|
|
# ── 265-3 관 길이 정수 ─────────────────────────────────────────────────
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
("length", "label"),
|
|
[(8.5, "L=9m"), (8.4, "L=8m"), (8.45, "L=8m"), (7.0, "L=7m"), (None, "L=")],
|
|
)
|
|
def test_원형_마크_L_은_사사오입_정수_TS_파이썬_같음(length, label):
|
|
design = {} if length is None else {"pipe_length_m": length}
|
|
culvert = {**_culvert_set(_PIPE), "chainage_m": 40.0}
|
|
case = {
|
|
"section": {"chainage_m": 40.0, "culvert": culvert, "design": design},
|
|
"station": "NO.2",
|
|
"options": _PIPE,
|
|
"chainage": 40.0,
|
|
"interval": 20.0,
|
|
}
|
|
[ts] = _mirror([case])
|
|
py = culvert_note_entities(40.0, culvert, design, "NO.2", _PIPE)
|
|
assert _labels(ts["entities"])[2] == label
|
|
assert _labels(py)[2] == label
|