55 lines
2.3 KiB
Python
55 lines
2.3 KiB
Python
from __future__ import annotations
|
|
|
|
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
|
|
import agent_semantic_pack_builder as builder
|
|
|
|
|
|
class AgentSemanticPackBuilderTests(unittest.TestCase):
|
|
def test_build_source_catalog_finds_reusable_meta_and_selected_object_tags(self) -> None:
|
|
catalog = builder.build_source_catalog()
|
|
summary = catalog["summary"]
|
|
|
|
self.assertGreater(summary["truth_harness_steps_total"], 0)
|
|
self.assertIn("meta_scope", summary["reusable_truth_harness_tags"])
|
|
self.assertIn("selected_object_supplier", summary["reusable_truth_harness_tags"])
|
|
self.assertIn("counterparty_documents", summary["reusable_truth_harness_tags"])
|
|
self.assertIn("planner_catalog_alignment", summary["reusable_truth_harness_tags"])
|
|
|
|
phase32_net_entry = next(
|
|
(
|
|
entry
|
|
for entry in catalog["truth_harness_entries"]
|
|
if entry["entry_id"]
|
|
== "address_truth_harness_phase32_planner_selected_chain_end_to_end:step_04_net_after_payout"
|
|
),
|
|
None,
|
|
)
|
|
self.assertIsNotNone(phase32_net_entry)
|
|
self.assertEqual(phase32_net_entry["expected_catalog_alignment_status"], "selected_matches_top")
|
|
self.assertEqual(phase32_net_entry["expected_catalog_chain_top_match"], "value_flow_comparison")
|
|
self.assertIs(phase32_net_entry["expected_catalog_selected_matches_top"], True)
|
|
self.assertIn("planner_catalog_alignment", phase32_net_entry["semantic_tags"])
|
|
|
|
def test_build_recipe_spec_creates_mixed_phase7_pack(self) -> None:
|
|
catalog = builder.build_source_catalog()
|
|
spec = builder.build_recipe_spec(catalog, "turnaround_11_phase7_meta_domain_mix")
|
|
|
|
self.assertEqual(spec["scenario_id"], "address_truth_harness_phase7_meta_domain_mix")
|
|
self.assertGreaterEqual(len(spec["steps"]), 10)
|
|
all_tags = {tag for step in spec["steps"] for tag in step.get("semantic_tags", [])}
|
|
self.assertIn("meta_scope", all_tags)
|
|
self.assertIn("meta_capability", all_tags)
|
|
self.assertIn("selected_object_supplier", all_tags)
|
|
self.assertIn("same_date_restore", all_tags)
|
|
self.assertIn("settlements_receivables", all_tags)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|