from __future__ import annotations import json import unittest from pathlib import Path ROOT = Path(__file__).resolve().parents[2] class ModuleSpecTests(unittest.TestCase): def test_module_spec_declares_pure_research_engine_boundary(self) -> None: spec = json.loads((ROOT / "MODULE_SPEC.yaml").read_text(encoding="utf-8")) self.assertEqual(spec["module_id"], "quant_engine") self.assertEqual(spec["authority"]["subject"], spec["module_id"]) self.assertEqual(spec["repository"]["type"], "research_engine") self.assertEqual(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"): self.assertIn(term, prohibited) self.assertEqual(spec["contracts"], {"provides": [], "consumes": []}) self.assertEqual(spec["dependencies"], []) self.assertTrue( all( command["required"] and not command["network"] for command in spec["verification"]["commands"] ) ) if __name__ == "__main__": unittest.main()