Spaces:
Running
Running
| 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() | |