Files
Aislo/resources/tester/test_clip_line_to_box.py
T
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

44 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
"""등고선·세류선 절취(clip_line_to_box)가 경계에서 정확히 끊기는지 확인한다."""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
from B07_DesignDetail.B07_DesignDetail_Router_Support import clip_line_to_box
BOX = (0.0, 0.0, 10.0, 10.0)
def test_경계를_넘는_선은_경계_위에서_끊긴다():
runs = clip_line_to_box([(-5.0, 5.0), (15.0, 5.0)], BOX)
assert runs == [[(0.0, 5.0), (10.0, 5.0)]]
def test_상자를_두_번_드나들면_조각이_둘이다():
line = [(-1.0, 5.0), (5.0, 5.0), (5.0, 20.0), (8.0, 20.0), (8.0, 5.0), (20.0, 5.0)]
runs = clip_line_to_box(line, BOX)
assert len(runs) == 2
assert runs[0][0] == (0.0, 5.0)
assert runs[0][-1] == (5.0, 10.0)
assert runs[1][0] == (8.0, 10.0)
assert runs[1][-1] == (10.0, 5.0)
def test_안에_전부_들면_그대로_남는다():
line = [(1.0, 1.0), (2.0, 3.0), (4.0, 2.0)]
assert clip_line_to_box(line, BOX) == [line]
def test_바깥에만_있으면_아무것도_안_남는다():
assert clip_line_to_box([(-5.0, -5.0), (-1.0, -3.0)], BOX) == []
def test_끝점이_경계를_넘지_않는다():
line = [(-3.0, 2.0), (12.0, 12.0), (5.0, -4.0)]
for run in clip_line_to_box(line, BOX):
for x, y in run:
assert -1e-9 <= x <= 10.0 + 1e-9
assert -1e-9 <= y <= 10.0 + 1e-9