From 74ed48d5d7202619f2f01fdaa16ec49fd2af5b05 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Thu, 5 Mar 2026 20:02:05 -0800 Subject: [PATCH] fix: Correct test assertion bug and inaccurate docstring Fix test_utorid_masked checking `result` (dict) instead of `output` (string). Update test_ca_policy_e2e.py docstring to clarify scope vs UofT tests. Co-Authored-By: Claude Opus 4.6 --- .../guardrail_hooks/content_filter/test_ca_policy_e2e.py | 7 ++++--- .../guardrail_hooks/content_filter/test_uoft_policy_e2e.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_ca_policy_e2e.py b/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_ca_policy_e2e.py index 37c1dcee438..f5efd238cfe 100644 --- a/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_ca_policy_e2e.py +++ b/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_ca_policy_e2e.py @@ -1,9 +1,10 @@ """ End-to-end tests for Canadian PII Protection (PIPEDA) policy template. -Tests the complete policy with all Canadian PII patterns — validates that -PII-containing prompts are detected/masked and that clean prompts pass through. -These tests mirror the canadianPiiCompliancePrompts.ts dataset. +Tests the federal/provincial PII patterns (SIN, OHIP, driver's licence, passport, +immigration docs, bank account, postal code) — validates that PII-containing prompts +are detected/masked and that clean prompts pass through. +University of Toronto institutional identifiers are tested separately in test_uoft_policy_e2e.py. """ import pytest diff --git a/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_uoft_policy_e2e.py b/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_uoft_policy_e2e.py index d9613da0988..23eefe3ef76 100644 --- a/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_uoft_policy_e2e.py +++ b/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_uoft_policy_e2e.py @@ -114,7 +114,7 @@ class TestUofTPolicyE2E: ) output = result.get("texts", [])[0] assert "[UOFT_UTORID_REDACTED]" in output - assert "smithj12" not in result + assert "smithj12" not in output @pytest.mark.asyncio async def test_utorid_quercus_context_masked(self):