The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(agent): trim inline-reasoning scrubber tests to two invariants (#89647)
kshitijk4poor5c70b151fcba
diff --git a/tests/agent/test_think_scrubber.py b/tests/agent/test_think_scrubber.pyindex 72d719d2398..38056bc6c89 100644--- a/tests/agent/test_think_scrubber.py+++ b/tests/agent/test_think_scrubber.py@@ -184,34 +184,23 @@ class TestRealisticStreaming:assert _drive(s, deltas) == "Hello world how are you?"+class TestReasoningCollection:"""The scrubber collects stripped reasoning for structured fields (#89647)."""- def test_collects_split_block_across_deltas(self) -> None:- s = StreamingThinkScrubber()- visible = _drive(s, ["<think>", "Let me check", " their config", "</think>", "Done."])- assert visible == "Done."- assert s.reasoning() == "Let me check\ntheir config"-- def test_collects_closed_pair_in_single_delta(self) -> None:- s = StreamingThinkScrubber()- visible = _drive(s, ["<think>inline reasoning</think>Hello"])- assert visible == "Hello"- assert s.reasoning() == "inline reasoning"-- def test_empty_when_no_reasoning(self) -> None:+ def test_streamed_blocks_rejoin_verbatim_and_tags_are_removed(self) -> None:s = StreamingThinkScrubber()- _drive(s, ["Just visible text"])- assert s.reasoning() == ""+ visible = _drive(s, ["<think>", "Let me check", " their config", "</think>", "Done. ",+ "<thinking>plan</thinking>ok"])+ assert visible == "Done. ok"+ assert s.reasoning() == "Let me check their config\nplan"- def test_strips_tag_markup_from_collected_text(self) -> None:- s = StreamingThinkScrubber()- _drive(s, ["<thinking>plan</thinking>ok"])- assert s.reasoning() == "plan"+ def test_per_request_reset_drops_previous_response_reasoning(self) -> None:+ from agent.stream_delivery import StreamDeliveryMixin- def test_reset_clears_collected_reasoning(self) -> None:- s = StreamingThinkScrubber()- _drive(s, ["<think>a</think>x"])- assert s.reasoning() == "a"- s.reset()- assert s.reasoning() == ""+ agent = StreamDeliveryMixin.__new__(StreamDeliveryMixin)+ agent._stream_think_scrubber = StreamingThinkScrubber()+ agent._stream_context_scrubber = None+ agent._stream_think_scrubber.feed("<think>first call</think>hi")+ agent._reset_stream_delivery_tracking()+ assert agent._stream_think_scrubber.reasoning() == ""