Files
Aislo/resources/tester/test_514_4_recommend_standard_default.py
T

53 lines
2.1 KiB
Python

"""PLAN 514-4 — 추천 저장본 접근 = 표준 횡단면 「없음」과 config 기본값을 같은 뜻으로.
./venv/Scripts/python.exe -m pytest resources/tester/test_514_4_recommend_standard_default.py -q
전처리 때 표준 없음(None)으로 셈 → B05 · B06 [저장]이 손대지 않은 패널 기본값을 실음 → 화면은
그 저장본을 꺼냄(409 아님 · 셈 0) · 반대 꼴도 · 사용자가 고친 표준은 옛 저장본을 안 끌어옴.
"""
from __future__ import annotations
import copy
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
TESTER = Path(__file__).resolve().parent
for path in (ROOT, TESTER):
if str(path) not in sys.path:
sys.path.insert(0, str(path))
from test_224_3_recommend_store import _ask, wired # noqa: E402, F401 — 가짜 세계 fixture
from B05_Profile.B05_Profile_Engine_RouteInitial_Store import DEFAULT_MODES # noqa: E402
from config.config_system import STANDARD_CROSS_SECTION # noqa: E402
def _chain_then_screen(wired, before, after) -> list[dict]: # noqa: F811
wired.standard = before
for mode in DEFAULT_MODES:
_ask(True, mode=mode)
count = wired.count
wired.standard = after
answers = [_ask(False, mode=mode) for mode in DEFAULT_MODES]
assert wired.count == count # 접근 = 셈 0
return answers
def test_전처리_없음_저장_뒤_기본값이면_꺼냄(wired) -> None: # noqa: F811
answers = _chain_then_screen(wired, None, copy.deepcopy(STANDARD_CROSS_SECTION))
assert all(isinstance(a, dict) and a["stored"] is True for a in answers), answers
def test_전처리_기본값_뒤_없음이어도_꺼냄(wired) -> None: # noqa: F811
answers = _chain_then_screen(wired, copy.deepcopy(STANDARD_CROSS_SECTION), None)
assert all(isinstance(a, dict) and a["stored"] is True for a in answers), answers
def test_고친_표준은_옛_저장본_안_끌어옴(wired) -> None: # noqa: F811
custom = copy.deepcopy(STANDARD_CROSS_SECTION)
custom["soil"]["road_width_m"] = 4.0
answers = _chain_then_screen(wired, None, custom)
assert all(getattr(a, "status_code", None) == 409 for a in answers), answers