test(factor): fundamental库测试补autouse幂等重注册(WP3修复文件漏提交) [nas]

[nas]

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
2026-09-08 00:50:41 +08:00
parent 4f7f5c6f5d
commit f7235d6194
+7
View File
@@ -11,6 +11,13 @@ from sanguo_factor import fundamental_library # noqa: F401 import 即注册
from sanguo_factor.fundamental_adapter import FEATURE_COLUMNS
from sanguo_factor.registry import list_factors, get_factor
@pytest.fixture(autouse=True)
def _ensure_fundamental_registered():
"""其它测试模块清空 _REGISTRY 后只重挂 alpha/builtin(顺序依赖前科),
这里逐测试幂等重注册财务因子,保证本模块与顺序无关."""
fundamental_library._register_all()
# 表达式可引用的列 = adapter 特征列 + 行情列 close(估值类 ÷ close×share_capital)
_ALLOWED = set(FEATURE_COLUMNS) | {"close", "cs_rank"}