MCPcopy Create free account
hub / github.com/IBM/mcp-cli / test_max_response_length_truncated

Method test_max_response_length_truncated

tests/agents/test_loop.py:231–254  ·  view source on GitHub ↗

Loop truncates last_response to 500 chars.

(self)

Source from the content-addressed store, hash-verified

229
230 @pytest.mark.asyncio
231 async def test_max_response_length_truncated(self):
232 """Loop truncates last_response to 500 chars."""
233 ctx = _make_context()
234 long_response = "x" * 1000
235 ctx.conversation_history = [
236 {"role": "assistant", "content": long_response},
237 ]
238 ui = _make_ui()
239 q: asyncio.Queue = asyncio.Queue()
240 done = asyncio.Event()
241
242 await q.put("go")
243 await q.put("exit")
244
245 mock_convo = MagicMock()
246 mock_convo.process_conversation = AsyncMock()
247
248 with patch(
249 "mcp_cli.chat.conversation.ConversationProcessor",
250 return_value=mock_convo,
251 ):
252 result = await run_agent_loop(ctx, ui, q, done)
253
254 assert len(result) == 500

Callers

nothing calls this directly

Calls 3

run_agent_loopFunction · 0.90
_make_contextFunction · 0.70
_make_uiFunction · 0.70

Tested by

no test coverage detected