99 lines
3.4 KiB
Python
99 lines
3.4 KiB
Python
import unittest
|
|
from pathlib import Path
|
|
|
|
try:
|
|
import tomllib
|
|
except ModuleNotFoundError: # pragma: no cover
|
|
import tomli as tomllib
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
AGENT_PATH = ROOT / ".codex" / "agents" / "io-definition-agent.toml"
|
|
IO_DEFINITIONS_README = ROOT / "docs" / "io-definitions" / "README.md"
|
|
|
|
|
|
class IoDefinitionAgentConfigTests(unittest.TestCase):
|
|
def test_io_definition_agent_toml_has_required_codex_fields(self):
|
|
data = tomllib.loads(AGENT_PATH.read_text(encoding="utf-8"))
|
|
|
|
self.assertEqual(data["name"], "io-definition-agent")
|
|
self.assertIn("Abaqus input-file subsets", data["description"])
|
|
self.assertEqual(data["sandbox_mode"], "read-only")
|
|
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
|
self.assertIn("developer_instructions", data)
|
|
|
|
def test_io_definition_agent_instructions_enforce_boundaries(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Do not implement parsers.",
|
|
"Do not design C++ APIs",
|
|
"Do not run Abaqus, Nastran, or any reference solver.",
|
|
"Do not generate reference CSVs.",
|
|
"Do not approve release readiness.",
|
|
"Do not claim full Abaqus compatibility",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_io_definition_agent_instructions_define_abaqus_input_contract(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"FESA solver input files are Abaqus input files.",
|
|
"Abaqus input files use keyword lines, data lines, and comment lines.",
|
|
"Model data and history data",
|
|
"supported Abaqus keyword subset",
|
|
"comparison CSV schemas",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_io_definition_agent_instructions_define_output_contract(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Abaqus Input Scope",
|
|
"Syntax Policy",
|
|
"Model Data Mapping",
|
|
"History Data Mapping",
|
|
"Internal Model Contract",
|
|
"Output and CSV Schemas",
|
|
"Validation Rules",
|
|
"Downstream Handoff",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_io_definition_agent_instructions_define_keyword_policy(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"*NODE",
|
|
"*ELEMENT",
|
|
"*MATERIAL",
|
|
"*BOUNDARY",
|
|
"*STEP",
|
|
"*OUTPUT",
|
|
"*NODE OUTPUT",
|
|
"*ELEMENT OUTPUT",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_io_definition_document_guide_defines_output_contract(self):
|
|
guide = IO_DEFINITIONS_README.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Abaqus Input Scope",
|
|
"Syntax Policy",
|
|
"Model Data Mapping",
|
|
"History Data Mapping",
|
|
"Internal Model Contract",
|
|
"Output and CSV Schemas",
|
|
"Validation Rules",
|
|
"Downstream Handoff",
|
|
"FESA 솔버의 입력 파일은 Abaqus input file이다.",
|
|
):
|
|
self.assertIn(required_text, guide)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|