8000 Fix Cohere tests (#3731) · getsentry/sentry-python@64ae2ef · GitHub
[go: up one dir, main page]

Skip to content

Commit 64ae2ef

Browse files
authored
Fix Cohere tests (#3731)
1 parent 453d152 commit 64ae2ef

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tests/integrations/cohere/test_cohere.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ def test_nonstreaming_chat(
5656
assert span["data"]["ai.model_id"] == "some-model"
5757

5858
if send_default_pii and include_prompts:
59-
assert "some context" in span["data"]["ai.input_messages"][0]["content"]
60-
assert "hello" in span["data"]["ai.input_messages"][1]["content"]
59+
input_messages = json.loads(span["data"]["ai.input_messages"])
60+
assert "some context" in input_messages[0]["content"]
61+
assert "hello" in input_messages[1]["content"]
6162
assert "the model response" in span["data"]["ai.responses"]
6263
else:
6364
assert "ai.input_messages" not in span["data"]
@@ -127,8 +128,9 @@ def test_streaming_chat(sentry_init, capture_events, send_default_pii, include_p
127128
assert span["data"]["ai.model_id"] == "some-model"
128129

129130
if send_default_pii and include_prompts:
130-
assert "some context" in span["data"]["ai.input_messages"][0]["content"]
131-
assert "hello" in span["data"]["ai.input_messages"][1]["content"]
131+
input_messages = json.loads(span["data"]["ai.input_messages"])
132+
assert "some context" in input_messages[0]["content"]
133+
assert "hello" in input_messages[1]["content"]
132134
assert "the model response" in span["data"]["ai.responses"]
133135
else:
134136
assert "ai.input_messages" not in span["data"]
@@ -150,7 +152,7 @@ def test_bad_chat(sentry_init, capture_events):
150152
with pytest.raises(httpx.HTTPError):
151153
client.chat(model="some-model", message="hello")
152154

153-
(event,) = events
155+
(event, _) = events
154156
assert event["level"] == "error"
155157

156158

0 commit comments

Comments
 (0)
0