Files
Chan/tests/test_golden_pipeline.py
T
jackyu66gitandCursor 081a57a90e feat: ECR-003 主站威科夫分析与图表叠层(已审)
独立 wyckoff 引擎 + 按需 include_wyckoff;主站 Lightweight 绘制区间/阶段/事件/VP。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-06 18:33:57 +08:00

52 lines
1.6 KiB
Python

"""Golden 回归:缠论流水线序列化结果应与基线一致。"""
from __future__ import annotations
import json
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_golden_pipeline():
r = subprocess.run(
[sys.executable, str(ROOT / "tests" / "generate_golden.py"), "--check"],
cwd=str(ROOT),
capture_output=True,
text=True,
)
assert r.returncode == 0, r.stdout + r.stderr
def test_package_imports():
from chanlun import ChanLun, TF_DF
from chanlun.core.ChanEnum import Chan_BI_DIR
assert ChanLun is not None and TF_DF is not None and Chan_BI_DIR is not None
def test_compat_shim_still_works():
"""根目录 shim 保留给外部旧脚本。"""
from ChanLun import ChanLun as C1
from TF_DF import TF_DF as T1
from ChanEnum import Chan_BI_DIR
from chanlun import ChanLun as C2, TF_DF as T2
assert C1 is C2 and T1 is T2 and Chan_BI_DIR is not None
def test_analyze_contract_keys_file():
doc = json.loads(
(ROOT / "tests" / "fixtures" / "analyze_contract_keys.json").read_text(
encoding="utf-8"
)
)
keys = doc["required"] if isinstance(doc, dict) and "required" in doc else doc
for k in ("kline_data", "bi_list", "seg_list", "zs_list", "bsp_list"):
assert k in keys
if isinstance(doc, dict):
assert "include_wyckoff" in doc.get("optional_when", {})
for k in ("trading_range", "phases", "events", "volume_profile"):
assert k in doc.get("wyckoff_keys", [])