feat: add Quant OS A-share baseline
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import json
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from tools.export_mock_parity import verify_report, write_report
|
||||
|
||||
|
||||
class MockParityReportTests(unittest.TestCase):
|
||||
def test_report_is_deterministic_and_explicitly_not_platform_evidence(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
first = Path(directory) / "first.json"
|
||||
second = Path(directory) / "second.json"
|
||||
report = write_report(first)
|
||||
write_report(second)
|
||||
self.assertEqual(first.read_bytes(), second.read_bytes())
|
||||
self.assertTrue(report["comparisons"]["whole_plan_exact"])
|
||||
self.assertEqual(report["evidence_class"], "mock_contract_only")
|
||||
self.assertFalse(report["real_platform_pass"])
|
||||
self.assertEqual(report["gate_credit"], [])
|
||||
self.assertTrue(verify_report(first)["ok"])
|
||||
|
||||
def test_tampering_is_rejected(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
path = Path(directory) / "report.json"
|
||||
write_report(path)
|
||||
report = json.loads(path.read_text(encoding="utf-8"))
|
||||
report["comparisons"]["whole_plan_exact"] = False
|
||||
path.write_text(json.dumps(report), encoding="utf-8")
|
||||
with self.assertRaisesRegex(ValueError, "hash mismatch"):
|
||||
verify_report(path)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user