"""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(): keys = json.loads( (ROOT / "tests" / "fixtures" / "analyze_contract_keys.json").read_text( encoding="utf-8" ) ) for k in ("kline_data", "bi_list", "seg_list", "zs_list", "bsp_list"): assert k in keys