Skip to content

Commit b46fd5f

Browse files
mostly whitespace test cleanup
1 parent f8f98c1 commit b46fd5f

8 files changed

Lines changed: 319 additions & 337 deletions

File tree

tests/integrations/anthropic/test_anthropic.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3675,7 +3675,6 @@ def test_anthropic_message_truncation(
36753675
assert SPANDATA.GEN_AI_REQUEST_MESSAGES in chat_span["attributes"]
36763676

36773677
messages_data = chat_span["attributes"][SPANDATA.GEN_AI_REQUEST_MESSAGES]
3678-
36793678
assert isinstance(messages_data, str)
36803679

36813680
parsed_messages = json.loads(messages_data)
@@ -3760,7 +3759,6 @@ async def test_anthropic_message_truncation_async(
37603759
for span in spans
37613760
if span["attributes"].get("sentry.op") == OP.GEN_AI_CHAT
37623761
]
3763-
37643762
assert len(chat_spans) > 0
37653763

37663764
chat_span = chat_spans[0]
@@ -3794,7 +3792,6 @@ async def test_anthropic_message_truncation_async(
37943792
chat_spans = [
37953793
span for span in tx.get("spans", []) if span.get("op") == OP.GEN_AI_CHAT
37963794
]
3797-
37983795
assert len(chat_spans) > 0
37993796

38003797
chat_span = chat_spans[0]

tests/integrations/google_genai/test_google_genai.py

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ def get_weather(location: str) -> str:
427427
tools_data_str = invoke_span["attributes"][
428428
SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS
429429
]
430-
431430
# Parse the JSON string to verify content
432431
tools_data = json.loads(tools_data_str)
433432
assert len(tools_data) == 2
@@ -452,7 +451,6 @@ def get_weather(location: str) -> str:
452451

453452
# Check that tools are recorded (data is serialized as a string)
454453
tools_data_str = invoke_span["data"][SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS]
455-
456454
# Parse the JSON string to verify content
457455
tools_data = json.loads(tools_data_str)
458456
assert len(tools_data) == 2
@@ -701,14 +699,10 @@ def test_streaming_generate_content(
701699
# Verify accumulated response text (all chunks combined)
702700
expected_full_text = "Hello! How can I help you today?"
703701
# Response text is stored as a JSON string
704-
if stream_gen_ai_spans:
705-
chat_response_text = json.loads(
706-
chat_span["attributes"][SPANDATA.GEN_AI_RESPONSE_TEXT]
707-
)
708-
else:
709-
chat_response_text = json.loads(
710-
chat_span["data"][SPANDATA.GEN_AI_RESPONSE_TEXT]
711-
)
702+
chat_response_text = json.loads(
703+
chat_span["attributes"][SPANDATA.GEN_AI_RESPONSE_TEXT]
704+
)
705+
712706
assert chat_response_text == [expected_full_text]
713707

714708
# Verify finish reasons (only the final chunk has a finish reason)
@@ -762,14 +756,9 @@ def test_streaming_generate_content(
762756
# Verify accumulated response text (all chunks combined)
763757
expected_full_text = "Hello! How can I help you today?"
764758
# Response text is stored as a JSON string
765-
if stream_gen_ai_spans:
766-
chat_response_text = json.loads(
767-
chat_span["attributes"][SPANDATA.GEN_AI_RESPONSE_TEXT]
768-
)
769-
else:
770-
chat_response_text = json.loads(
771-
chat_span["data"][SPANDATA.GEN_AI_RESPONSE_TEXT]
772-
)
759+
chat_response_text = json.loads(
760+
chat_span["data"][SPANDATA.GEN_AI_RESPONSE_TEXT]
761+
)
773762
assert chat_response_text == [expected_full_text]
774763

775764
# Verify finish reasons (only the final chunk has a finish reason)
@@ -1592,7 +1581,6 @@ def test_embed_content(
15921581
(event,) = events
15931582

15941583
assert event["type"] == "transaction"
1595-
15961584
assert event["transaction"] == "google_genai_embeddings"
15971585

15981586
# Should have 1 span for embeddings
@@ -1697,7 +1685,6 @@ def test_embed_content_string_input(
16971685

16981686
# Check that single string is handled correctly
16991687
input_texts = json.loads(embed_span["data"][SPANDATA.GEN_AI_EMBEDDINGS_INPUT])
1700-
17011688
assert input_texts == ["Single text input"]
17021689
# Should use token_count from statistics (5), not billable_character_count (10)
17031690
# Note: Only available in newer versions with ContentEmbeddingStatistics
@@ -2064,7 +2051,6 @@ async def test_async_embed_content_string_input(
20642051
input_texts = json.loads(
20652052
embed_span["attributes"][SPANDATA.GEN_AI_EMBEDDINGS_INPUT]
20662053
)
2067-
20682054
assert input_texts == ["Single text input"]
20692055
# Should use token_count from statistics (5), not billable_character_count (10)
20702056
# Note: Only available in newer versions with ContentEmbeddingStatistics
@@ -2088,7 +2074,6 @@ async def test_async_embed_content_string_input(
20882074

20892075
# Check that single string is handled correctly
20902076
input_texts = json.loads(embed_span["data"][SPANDATA.GEN_AI_EMBEDDINGS_INPUT])
2091-
20922077
assert input_texts == ["Single text input"]
20932078
# Should use token_count from statistics (5), not billable_character_count (10)
20942079
# Note: Only available in newer versions with ContentEmbeddingStatistics

tests/integrations/huggingface_hub/test_huggingface_hub.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,6 @@ def test_chat_completion_streaming(
938938
"thread.id": mock.ANY,
939939
"thread.name": mock.ANY,
940940
}
941-
942941
# usage is not available in older versions of the library
943942
if HF_VERSION and HF_VERSION >= (0, 26, 0):
944943
expected_data["gen_ai.usage.input_tokens"] = 183

0 commit comments

Comments
 (0)