Add offline workflow and coverage tests

This commit is contained in:
Yuxuan Yan
2026-06-16 17:37:16 +08:00
parent 8d908477e2
commit 31baa18ce5
16 changed files with 2104 additions and 9 deletions
+22
View File
@@ -13,6 +13,7 @@ from pipeline.features.registry import (
get_feature,
load_feature_module,
)
from pipeline.derived.compute import compute_derived
def _minute_bars() -> pd.DataFrame:
@@ -77,6 +78,27 @@ def test_minute_daily_summary_feature_preserves_legacy_positional_compute():
pd.testing.assert_frame_equal(direct, via_registry)
def test_legacy_feature_compute_matches_canonical_derived_compute():
daily = pd.DataFrame({
"symbol_id": ["sh600000", "sz000001", "sh600000"],
"date": pd.to_datetime(["2024-01-02", "2024-01-02", "2024-01-03"]),
"close": [11.0, 20.5, 12.0],
})
legacy_feature = compute_feature(
minute=_minute_bars(),
daily=daily,
feature_type="minute_daily_summary",
)
canonical_derived = compute_derived(
"minute_daily_summary",
daily=daily,
minute=_minute_bars(),
)
pd.testing.assert_frame_equal(legacy_feature, canonical_derived)
def test_load_external_feature_module_and_filter_params(tmp_path):
module_path = tmp_path / "external_feature.py"
module_path.write_text(textwrap.dedent('''