Spaces:
Running
Running
File size: 1,381 Bytes
630d650 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
from pathlib import Path
from toxra_core.artifacts import make_run_dir
from toxra_core.calculation_client import MCPCalculationClient
def test_mcp_client_lists_tools_and_runs_batch(tmp_path):
run_dir = make_run_dir(run_id="test_mcp", base_dir=str(tmp_path))
with MCPCalculationClient(run_dir=str(run_dir)) as client:
tools = client.list_tools()
names = {t.get("name") for t in tools}
assert "run_batch_cancer_risk" in names
result = client.call_tool(
"run_batch_cancer_risk",
{
"rows": [
{
"record_id": "r1",
"chemical_name": "ChemA",
"route": "oral",
"exposure_value": 0.01,
"exposure_unit": "mg/kg-day",
"body_weight_kg": 70,
"csf_value": 1.2,
"csf_unit": "(mg/kg-day)^-1",
"iur_value": "",
"air_conc_value": "",
"air_conc_unit": "",
}
]
},
)
assert result["summary"]["total_rows"] == 1
assert result["summary"]["ok_rows"] == 1
assert Path(result["artifacts"]["log_jsonl"]).exists()
assert Path(result["artifacts"]["report_md"]).exists()
|