Files
Aislo/resources/tester/test_structure_face_role.py
eomsangdonandClaude Opus 5 0ef32b5279 chore(tester): 시험을 resources/tester/ 로 옮김 — 창끼리 건너가게
⚠ **뿌리** — `tmp/` 는 창 사이에 안 건너감(실측 확인: 상대 창이 놓은 `tmp/_sync_probe.txt`
가 시간을 두고 두 번 봐도 안 보임). 그래서 **정본(등록부 스키마)만 건너가고 그것을 읽는
시험은 안 건너가** 오늘 두 번, 같은 시험이 **연 창은 통과·받은 창은 실패**가 됐음.

- `tmp/tests/*` 를 `resources/tester/` 로 **복사**(127 파일). 내용은 **한 줄도 안 고침**
- `tmp/tests` 는 **남겨 둠** — 되돌릴 자리(사용자 지시)
- 실행: `./venv/Scripts/python.exe -m pytest resources/tester/ -q`
  옮기기 전과 **같은 수**: 617 통과 / 22 건너뜀 / 실패 0

⇒ 이제 시험·예외·까닭이 **정본과 함께** 움직임. 오늘 세운 「예외는 정본 스키마에」와 짝임.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-09 17:12:30 +09:00

80 lines
2.7 KiB
Python

"""구조물 자리가 성토면인가 절토면인가 — 판정 한 벌 (2026-09-09).
품셈 표준경사 표가 높이 × 메/찰 × **성토/절토** 로 갈리는데 성절토만 없었다.
새 입력을 만들지 않고 `design.section_mode` + 구조물 `side` 로 가린다.
⚠ 못 가르면 `None` — 성토로 눅이지 않는다.
"""
from __future__ import annotations
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 common_util.common_util_structure_face_role import ( # noqa: E402
CUT,
FILL,
structure_face_role,
)
@pytest.mark.parametrize(
("mode", "side", "expected"),
[
("left_cut", "좌", CUT),
("left_cut", "우", FILL),
("right_cut", "좌", FILL),
("right_cut", "우", CUT),
("both_cut", "좌", CUT),
("both_cut", "우", CUT),
("both_fill", "좌", FILL),
("both_fill", "우", FILL),
],
)
def test_네_단면유형_좌우_여덟(mode: str, side: str, expected: str) -> None:
role, reason = structure_face_role(mode, side)
assert role == expected
assert mode in reason and expected in reason
def test_자동은_성토면이다() -> None:
role, reason = structure_face_role("right_cut", "자동(성토 쪽)")
assert role == FILL
assert "자동" in reason
def test_양쪽_절토에_자동이면_가를_근거가_없다() -> None:
"""⚠ 예외 하나 — 성토면이 없어 어느 쪽인지 정할 근거가 없다."""
role, reason = structure_face_role("both_cut", "자동(성토 쪽)")
assert role is None
assert "근거 없음" in reason
def test_양쪽_성토에_자동이면_성토면이다() -> None:
role, _ = structure_face_role("both_fill", "자동(성토 쪽)")
assert role == FILL
def test_모르는_값은_None_이고_성토로_눅이지_않는다() -> None:
for mode, side in (("", "좌"), ("cut_fill", "좌"), ("left_cut", "가운데"), (None, None)):
role, reason = structure_face_role(mode, side)
assert role is None, (mode, side)
assert "근거 없음" in reason
def test_옛_영문_표기도_받는다() -> None:
"""저장분에 영문이 남아 있을 수 있다 — 같은 뜻으로 읽는다."""
assert structure_face_role("left_cut", "left")[0] == CUT
assert structure_face_role("left_cut", "right")[0] == FILL
assert structure_face_role("right_cut", "auto")[0] == FILL
def test_까닭_문구는_한_줄로_실을_수_있다() -> None:
_, reason = structure_face_role("right_cut", "좌")
assert reason == "right_cut · 좌측 → 성토면"