Skip to content

Commit fccd72f

Browse files
simplify
1 parent d1d8160 commit fccd72f

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

tests/integrations/langchain/test_langchain.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -304,29 +304,9 @@ def test_langchain_agent(
304304
assert chat_spans[1]["data"][SPANDATA.GEN_AI_RESPONSE_FINISH_REASONS] == ["stop"]
305305

306306
# Verify that available tools are always recorded regardless of PII settings
307-
tools_found = False
308307
for chat_span in chat_spans:
309-
span_data = chat_span.get("data", {})
310-
if SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS in span_data:
311-
tools_found = True
312-
tools_data = span_data[SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS]
313-
assert tools_data is not None, (
314-
"Available tools should always be recorded regardless of PII settings"
315-
)
316-
317-
if isinstance(tools_data, str):
318-
# If serialized as string, should contain tool name
319-
assert "get_word_length" in tools_data
320-
else:
321-
# If still a list, verify structure
322-
assert len(tools_data) >= 1
323-
names = [
324-
tool.get("name") for tool in tools_data if isinstance(tool, dict)
325-
]
326-
assert "get_word_length" in names
327-
328-
# Ensure we found at least one span with tools data
329-
assert tools_found, "No spans found with tools data"
308+
tools_data = chat_span["data"][SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS]
309+
assert "get_word_length" in tools_data
330310

331311

332312
def test_langchain_error(sentry_init, capture_events):

0 commit comments

Comments
 (0)