Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QfHKQs7J3hQELKMWQMUJEy
60 lines
2.1 KiB
Python
60 lines
2.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""354-2 유토곡선 종단 기준 숨김 — 안 셈 · 안 그림 · 범례 단추 없음(코드 남김).
|
|
|
|
- 그리기 = 횡단 기준만(`["cross"]`) · 범례는 낸 계열마다라 종단 단추가 안 섬.
|
|
- 저장된 범례가 종단(`longitudinal`)이면 횡단으로 맞춤 · 분배 켬은 그대로.
|
|
- 계산 묶음 단계(MassHaul_Stage)는 두 기준 그대로 · 공용 계산 코드 남김.
|
|
|
|
`helper_354_2_masshaul_cross_only.cjs` 가 진짜 TS 를 잘라 돌림.
|
|
"""
|
|
|
|
import json
|
|
import os
|
|
import re
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
ROOT = Path(HERE).parents[1]
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def r():
|
|
proc = subprocess.run(
|
|
["node", os.path.join(HERE, "helper_354_2_masshaul_cross_only.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_저장된_종단_범례는_횡단으로(r):
|
|
assert r["longitudinal"] == ["cross"]
|
|
assert r["longitudinalBalance"] == ["balance", "cross"]
|
|
assert r["cross"] == ["cross"]
|
|
assert r["empty"] == ["cross"] and r["broken"] == ["cross"]
|
|
|
|
|
|
def test_기준_횡단만_계산(r):
|
|
assert r["crossOnly"] == ["cross"]
|
|
assert r["both"] == ["cross", "longitudinal"] # 공용 기본값 = 묶음 단계 그대로
|
|
|
|
|
|
def test_그리기는_횡단만_부름():
|
|
mass = (ROOT / "B05_Profile/B05_Profile_UI_Profile_MassHaul.ts").read_text(encoding="utf-8")
|
|
calls = re.findall(r"computeMassHaulSeries\(([^;]*?)\)", mass, re.S)
|
|
assert calls and all('["cross"]' in call for call in calls)
|
|
|
|
|
|
def test_묶음_단계와_공용_코드는_그대로():
|
|
stage = (ROOT / "B05_Profile/logic/B05_Profile_MassHaul_Stage.ts").read_text(encoding="utf-8")
|
|
assert '["cross"]' not in stage
|
|
util = (ROOT / "common_util/common_util_mass_haul.ts").read_text(encoding="utf-8")
|
|
assert 'const SERIES_BASES: MassHaulBasis[] = ["cross", "longitudinal"];' in util
|
|
assert "longitudinalAreaSamples(longitudinal, sections)" in util
|