From b52585e276bd12c690491cf6c5a3363a5412d020 Mon Sep 17 00:00:00 2001 From: Mrunmayee Daware <165297479+Mrun25@users.noreply.github.com> Date: Fri, 30 Oct 2026 18:59:33 +0530 Subject: [PATCH] test(responses): assert deduplication preserves the input list --- .../test_encrypted_content_affinity_check.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/unit/router_utils/pre_call_checks/test_encrypted_content_affinity_check.py b/tests/unit/router_utils/pre_call_checks/test_encrypted_content_affinity_check.py index f4ff448299c..629cd1aa3e5 100644 --- a/tests/unit/router_utils/pre_call_checks/test_encrypted_content_affinity_check.py +++ b/tests/unit/router_utils/pre_call_checks/test_encrypted_content_affinity_check.py @@ -192,6 +192,8 @@ class TestRestoreDropsDuplicateReplayedCopies: {"role": "user", "content": "again"}, ] result = ResponsesAPIRequestUtils.restore_encrypted_content_item_ids_in_input(request_input) + assert result is not request_input + assert len(request_input) == 4 reasoning = [i for i in result if isinstance(i, dict) and i.get("type") == "reasoning"] assert len(reasoning) == 1 assert reasoning[0]["id"] == "rs_dup" @@ -515,7 +517,9 @@ async def test_encrypted_content_affinity_bypasses_rpm_limits(): # Extract the replayable item from the first response output replayed_item = _extract_encrypted_item(first_response) - assert replayed_item["id"] == "rs_encrypted_must_pin", f"Expected the provider's item ID, got {replayed_item['id']!r}" + assert replayed_item["id"] == "rs_encrypted_must_pin", ( + f"Expected the provider's item ID, got {replayed_item['id']!r}" + ) assert replayed_item["encrypted_content"].startswith("litellm_enc:") # Follow-up replaying the wrapped item — should pin to same deployment