"""451 B06 에서 노선 초안 버림 바로 뒤 cross 입력이 와도 되돌림까지(B05 와 같게). ① 버림 차례가 뒤 차례(cross)에 밀리면 마지막 차례 끝에서 되돌림 한 번 · 밀어낸 차례도 가게에 측점 안 냄 · 종단도는 되돌림 뒤 저장 기준 ② 안 밀린 버림(B05) = 그 차례에서 되돌림 그대로 ③ 버림 뒤 새 초안이 밀어냄 = 되돌림 없음(초안이 이김) 짝: `helper_451_drop_cross.cjs`(진짜 TS · 서버 창구만 가짜 · 가짜 지형 = 346-2 틀). ./venv/Scripts/python.exe -m pytest resources/tester/test_451_drop_cross.py -q """ from __future__ import annotations import json import subprocess import sys import tempfile from pathlib import Path import pytest HERE = Path(__file__).resolve().parent if str(HERE) not in sys.path: sys.path.insert(0, str(HERE)) import test_365_page_pipeline as page # noqa: E402 pytestmark = page.pytestmark @pytest.fixture(scope="module") def r() -> dict: with tempfile.TemporaryDirectory() as folder: path, grid = page._job(Path(folder)) proc = subprocess.run( # noqa: S603 — 고정 실행 파일 ["node", str(HERE / "helper_451_drop_cross.cjs"), str(path), str(grid)], capture_output=True, text=True, encoding="utf-8", timeout=180, ) assert proc.returncode == 0, proc.stderr return json.loads(proc.stdout) def test_밀린_버림도_되돌림(r) -> None: assert r["moved"] is True # 초안이 측점을 바꿈(시험이 갈아끼움 길을 거침) assert r["runs"][0][1] == "dropped" # 버림 차례가 cross 에 밀림 assert len(r["restores"]) == 1 assert r["runs"][-1][1:] == ["done", "saved"] assert r["stationsPublished"] is False # 밀어낸 차례도 조용히(되돌림이 맡음) assert r["adopts"] == ["saved"] and r["restores"][0]["at"] == 0 # 종단도 = 되돌림 뒤 assert r["routeDraft"] is None def test_안_밀린_버림_그대로(r) -> None: assert r["plain"]["runs"] == [["route", "done", "saved"]] assert r["plain"]["restores"] == 1 def test_새_초안이_밀면_되돌림_없음(r) -> None: assert r["redraft"]["restores"] == 0 assert r["redraft"]["draft"] is True