test(compressor): tidy blank-line spacing + assert placeholder never overwrites text

Review follow-up on the batch salvage: normalize the inter-class spacing to two
blank lines (PEP8) between the three new test classes, and add an explicit
assertion in test_sanitizer_strips_orphaned_preserves_text_content that the
'(tool call removed)' placeholder does NOT overwrite existing assistant text.
No production change.
This commit is contained in:
kshitijk4poor 2026-07-01 14:16:31 +05:30 committed by kshitij
parent 8f4d195d5f
commit 6e97f5c3f8

View file

@ -2921,8 +2921,6 @@ class TestTurnPairPreservation:
)
class TestSanitizerStripsOrphanedToolCalls:
"""PR #51218 (salvaged from #51225): orphaned tool_calls are stripped from
assistant messages instead of having stub tool results inserted, avoiding
@ -2997,6 +2995,8 @@ class TestSanitizerStripsOrphanedToolCalls:
asst = next(m for m in sanitized if m.get("role") == "assistant")
assert asst["content"] == "Let me search for that."
assert not asst.get("tool_calls")
# The placeholder must NOT overwrite existing text content.
assert asst["content"] != "(tool call removed)"
def test_sanitizer_strips_orphaned_with_call_id_mismatch(self, compressor):
"""Stubs with call_id != id used to be dropped by downstream
@ -3025,8 +3025,6 @@ class TestSanitizerStripsOrphanedToolCalls:
# No stub tool messages (which would have call_id != id mismatch)
class TestCooldownReentryAbort:
"""Regression: a second compress() call during the failure cooldown must
still abort when the original failure was a network/auth error.
@ -3106,8 +3104,6 @@ class TestCooldownReentryAbort:
assert c._last_summary_fallback_used is False
class TestDoubleCompactionSummaryRole:
"""PR #52160 (salvaged from #52167): when only the system prompt is
protected, the summary must lead with role=user (Anthropic/Bedrock send