"""구조물 자리가 성토면인가 절토면인가 — 판정 한 벌 (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 · 좌측 → 성토면"