diff --git a/tests/test_safety.py b/tests/test_safety.py index cec5c6f..d2cfeb4 100644 --- a/tests/test_safety.py +++ b/tests/test_safety.py @@ -6,6 +6,7 @@ from pathlib import Path import pytest import yaml +from app.core.privacy import scrub from app.core.safety import ( CrisisScript, SafetyResult, @@ -40,6 +41,12 @@ def test_acute_recall_is_100_percent(case: dict) -> None: assert check(ScrubbedText(case["text"])).level == RiskLevel.ACUTE +@pytest.mark.parametrize("case", ACUTE, ids=_ids(ACUTE)) +def test_acute_recall_survives_scrub(case: dict) -> None: + # Real pipeline: scrub() runs first, so PII placeholders must not break crisis detection. + assert check(scrub(case["text"])).level == RiskLevel.ACUTE + + @pytest.mark.parametrize("case", NOT_ACUTE, ids=_ids(NOT_ACUTE)) def test_non_acute_cases_match_label(case: dict) -> None: # Exact level documents the calibration; the hard requirement is "never ACUTE" for these.