52 lines
1.7 KiB
Python
52 lines
1.7 KiB
Python
from __future__ import annotations
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def test_module_spec_declares_pure_research_engine_boundary() -> None:
|
|
spec = json.loads((ROOT / "MODULE_SPEC.yaml").read_text(encoding="utf-8"))
|
|
assert spec["module_id"] == "quant_engine"
|
|
assert spec["authority"]["subject"] == spec["module_id"]
|
|
assert spec["repository"]["type"] == "research_engine"
|
|
assert spec["bounded_context"]["domain"] == "quantitative-research-engine"
|
|
prohibited = " ".join(spec["bounded_context"]["prohibited_responsibilities"]).lower()
|
|
for term in ("investment advice", "live order", "credentials", "source facts"):
|
|
assert term in prohibited
|
|
assert spec["authority"]["revision"] == 2
|
|
assert {
|
|
(item["contract_id"], item["version"])
|
|
for item in spec["contracts"]["provides"]
|
|
} == {
|
|
("researchhub.factor-definition", "1.0.0"),
|
|
("researchhub.factor-set-ref", "1.0.0"),
|
|
}
|
|
assert all(
|
|
item["authority"] == "quant_engine"
|
|
and item["path"] == "src/quant_engine/factor_contracts.py"
|
|
for item in spec["contracts"]["provides"]
|
|
)
|
|
assert {
|
|
(item["contract_id"], item["version"])
|
|
for item in spec["contracts"]["consumes"]
|
|
} == {
|
|
("researchhub.dataset-snapshot", "1.0.0"),
|
|
("researchhub.data-foundation", "1.0.0"),
|
|
}
|
|
assert all(
|
|
item["authority"] == "researchhub.data"
|
|
for item in spec["contracts"]["consumes"]
|
|
)
|
|
assert spec["dependencies"] == []
|
|
assert all(
|
|
command["required"] and not command["network"]
|
|
for command in spec["verification"]["commands"]
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_module_spec_declares_pure_research_engine_boundary()
|