Spaces:
Running
Running
File size: 590 Bytes
877add7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import pytest
from pydantic import ValidationError
from app.models.policy.output_schema import DecisionSchema
def test_policy_schema_forbids_unknown_keys() -> None:
payload = {
"mode": "REGIMEN_OPT",
"action_type": "KEEP_REGIMEN",
"target_drug": None,
"replacement_drug": None,
"dose_bucket": "NA",
"taper_days": None,
"monitoring_plan": None,
"candidate_id": "cand_01",
"confidence": 0.8,
"unexpected": "x",
}
with pytest.raises(ValidationError):
DecisionSchema.model_validate(payload)
|