From 9e952605aed33b926ad54d685e8852c1e08cd50f Mon Sep 17 00:00:00 2001 From: Mrunmayee Daware <165297479+Mrun25@users.noreply.github.com> Date: Sun, 11 Oct 2026 10:31:02 +0530 Subject: [PATCH] test(anthropic): make the mid-conversation tool attachment assertion real --- .../anthropic/test_count_tokens_mid_conversation_system.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/llms/anthropic/test_count_tokens_mid_conversation_system.py b/tests/unit/llms/anthropic/test_count_tokens_mid_conversation_system.py index ffcc9b9c63d..2730d5e1964 100644 --- a/tests/unit/llms/anthropic/test_count_tokens_mid_conversation_system.py +++ b/tests/unit/llms/anthropic/test_count_tokens_mid_conversation_system.py @@ -110,8 +110,8 @@ class TestMidConversationSystemPlacement: ) roles: Final = [message["role"] for message in result["messages"]] assert "system" not in roles - first_tool_index: Final = roles.index("tool") if "tool" in roles else -1 + first_tool_index: Final = roles.index("tool") # tool content must remain attached to its own message before any converted text - assert first_tool_index != -1 or True + assert roles[first_tool_index + 1] == "user" wire_text: Final = str(result["messages"]) assert "tool_result" in wire_text and "be terse" in wire_text