test(core): check acute recall after scrub() pipeline
CI / ruff · pytest (pull_request) Successful in 30s
CI / ruff · pytest (pull_request) Successful in 30s
Refs #4 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ from pathlib import Path
|
|||||||
import pytest
|
import pytest
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
from app.core.privacy import scrub
|
||||||
from app.core.safety import (
|
from app.core.safety import (
|
||||||
CrisisScript,
|
CrisisScript,
|
||||||
SafetyResult,
|
SafetyResult,
|
||||||
@@ -40,6 +41,12 @@ def test_acute_recall_is_100_percent(case: dict) -> None:
|
|||||||
assert check(ScrubbedText(case["text"])).level == RiskLevel.ACUTE
|
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))
|
@pytest.mark.parametrize("case", NOT_ACUTE, ids=_ids(NOT_ACUTE))
|
||||||
def test_non_acute_cases_match_label(case: dict) -> None:
|
def test_non_acute_cases_match_label(case: dict) -> None:
|
||||||
# Exact level documents the calibration; the hard requirement is "never ACUTE" for these.
|
# Exact level documents the calibration; the hard requirement is "never ACUTE" for these.
|
||||||
|
|||||||
Reference in New Issue
Block a user