60 lines
1.8 KiB
Python
60 lines
1.8 KiB
Python
from __future__ import annotations
|
|
|
|
import json
|
|
import sys
|
|
|
|
import pytest
|
|
|
|
import hyperscalper_wave1_feature_synthesis_v1 as synthesis
|
|
|
|
pytestmark = pytest.mark.django_db
|
|
|
|
|
|
def test_synthesis_requires_explicit_ohlcv_and_reports_missing_failure_artifact(
|
|
tmp_path, monkeypatch
|
|
):
|
|
features = [
|
|
{
|
|
"indicator_id": index,
|
|
"period": 10,
|
|
"p1": 0,
|
|
"domain": "trend",
|
|
"output_type": "continuous",
|
|
"input_scope": "OHLCV_ONLY",
|
|
}
|
|
for index in range(20)
|
|
] + [{"indicator_id": 99, "period": 10, "p1": 0, "input_scope": "EXTERNAL"}]
|
|
semantic = tmp_path / "semantic.json"
|
|
semantic.write_text(json.dumps({"features": features}), encoding="utf-8")
|
|
redundancy = tmp_path / "redundancy.json"
|
|
redundancy.write_text(json.dumps({"clusters": []}), encoding="utf-8")
|
|
deq = tmp_path / "deq.json"
|
|
deq.write_text(json.dumps({"feature_summaries": []}), encoding="utf-8")
|
|
gap = tmp_path / "gap.json"
|
|
gap.write_text(json.dumps({"information_map": {"features": []}}), encoding="utf-8")
|
|
output = tmp_path / "out"
|
|
monkeypatch.setattr(
|
|
sys,
|
|
"argv",
|
|
[
|
|
"runner",
|
|
"--semantic-summary",
|
|
str(semantic),
|
|
"--redundancy-clusters",
|
|
str(redundancy),
|
|
"--deq-summary",
|
|
str(deq),
|
|
"--lineage-gap-analysis",
|
|
str(gap),
|
|
"--output-dir",
|
|
str(output),
|
|
],
|
|
)
|
|
|
|
synthesis.main()
|
|
|
|
result = json.loads((output / "new_feature_candidate_registry_v1.json").read_text())
|
|
assert len(result["candidates"]) == 20
|
|
assert result["status"] == "BLOCKED"
|
|
assert result["sources"]["failure_mining"]["status"] == "UNAVAILABLE"
|
|
assert all(item["input_scope"] == "OHLCV_ONLY" for item in result["candidates"])
|