Skip to content

Commit d0e76af

Browse files
remove some local vars in tests
1 parent fc69b80 commit d0e76af

1 file changed

Lines changed: 12 additions & 24 deletions

File tree

‎tests/integrations/anthropic/test_anthropic.py‎

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,9 +1926,8 @@ def test_streaming_create_message_close(
19261926
span["attributes"][SPANDATA.GEN_AI_REQUEST_MESSAGES]
19271927
== '[{"role": "user", "content": "Hello, Claude"}]'
19281928
)
1929-
expected_parts = [{"type": "text", "content": "Hi!"}]
19301929
assert json.loads(span["attributes"][SPANDATA.GEN_AI_OUTPUT_MESSAGES]) == [
1931-
{"role": "assistant", "parts": expected_parts}
1930+
{"role": "assistant", "parts": [{"type": "text", "content": "Hi!"}]}
19321931
]
19331932

19341933
assert span["attributes"][SPANDATA.GEN_AI_USAGE_INPUT_TOKENS] == 10
@@ -1975,9 +1974,8 @@ def test_streaming_create_message_close(
19751974
span["attributes"][SPANDATA.GEN_AI_REQUEST_MESSAGES]
19761975
== '[{"role": "user", "content": "Hello, Claude"}]'
19771976
)
1978-
expected_parts = [{"type": "text", "content": "Hi!"}]
19791977
assert json.loads(span["attributes"][SPANDATA.GEN_AI_OUTPUT_MESSAGES]) == [
1980-
{"role": "assistant", "parts": expected_parts}
1978+
{"role": "assistant", "parts": [{"type": "text", "content": "Hi!"}]}
19811979
]
19821980

19831981
assert span["attributes"][SPANDATA.GEN_AI_USAGE_INPUT_TOKENS] == 10
@@ -2023,9 +2021,8 @@ def test_streaming_create_message_close(
20232021
span["data"][SPANDATA.GEN_AI_REQUEST_MESSAGES]
20242022
== '[{"role": "user", "content": "Hello, Claude"}]'
20252023
)
2026-
expected_parts = [{"type": "text", "content": "Hi!"}]
20272024
assert json.loads(span["data"][SPANDATA.GEN_AI_OUTPUT_MESSAGES]) == [
2028-
{"role": "assistant", "parts": expected_parts}
2025+
{"role": "assistant", "parts": [{"type": "text", "content": "Hi!"}]}
20292026
]
20302027

20312028
assert span["data"][SPANDATA.GEN_AI_USAGE_INPUT_TOKENS] == 10
@@ -2698,9 +2695,8 @@ def test_stream_messages_close(
26982695
span["attributes"][SPANDATA.GEN_AI_REQUEST_MESSAGES]
26992696
== '[{"role": "user", "content": "Hello, Claude"}]'
27002697
)
2701-
expected_parts = [{"type": "text", "content": "Hi!"}]
27022698
assert json.loads(span["attributes"][SPANDATA.GEN_AI_OUTPUT_MESSAGES]) == [
2703-
{"role": "assistant", "parts": expected_parts}
2699+
{"role": "assistant", "parts": [{"type": "text", "content": "Hi!"}]}
27042700
]
27052701

27062702
assert span["attributes"][SPANDATA.GEN_AI_USAGE_INPUT_TOKENS] == 10
@@ -2751,9 +2747,8 @@ def test_stream_messages_close(
27512747
span["attributes"][SPANDATA.GEN_AI_REQUEST_MESSAGES]
27522748
== '[{"role": "user", "content": "Hello, Claude"}]'
27532749
)
2754-
expected_parts = [{"type": "text", "content": "Hi!"}]
27552750
assert json.loads(span["attributes"][SPANDATA.GEN_AI_OUTPUT_MESSAGES]) == [
2756-
{"role": "assistant", "parts": expected_parts}
2751+
{"role": "assistant", "parts": [{"type": "text", "content": "Hi!"}]}
27572752
]
27582753

27592754
assert span["attributes"][SPANDATA.GEN_AI_USAGE_INPUT_TOKENS] == 10
@@ -2803,9 +2798,8 @@ def test_stream_messages_close(
28032798
span["data"][SPANDATA.GEN_AI_REQUEST_MESSAGES]
28042799
== '[{"role": "user", "content": "Hello, Claude"}]'
28052800
)
2806-
expected_parts = [{"type": "text", "content": "Hi!"}]
28072801
assert json.loads(span["data"][SPANDATA.GEN_AI_OUTPUT_MESSAGES]) == [
2808-
{"role": "assistant", "parts": expected_parts}
2802+
{"role": "assistant", "parts": [{"type": "text", "content": "Hi!"}]}
28092803
]
28102804

28112805
assert span["data"][SPANDATA.GEN_AI_USAGE_INPUT_TOKENS] == 10
@@ -3487,9 +3481,8 @@ async def test_streaming_create_message_async_close(
34873481
span["attributes"][SPANDATA.GEN_AI_REQUEST_MESSAGES]
34883482
== '[{"role": "user", "content": "Hello, Claude"}]'
34893483
)
3490-
expected_parts = [{"type": "text", "content": "Hi!"}]
34913484
assert json.loads(span["attributes"][SPANDATA.GEN_AI_OUTPUT_MESSAGES]) == [
3492-
{"role": "assistant", "parts": expected_parts}
3485+
{"role": "assistant", "parts": [{"type": "text", "content": "Hi!"}]}
34933486
]
34943487

34953488
assert span["attributes"][SPANDATA.GEN_AI_USAGE_INPUT_TOKENS] == 10
@@ -3535,9 +3528,8 @@ async def test_streaming_create_message_async_close(
35353528
span["attributes"][SPANDATA.GEN_AI_REQUEST_MESSAGES]
35363529
== '[{"role": "user", "content": "Hello, Claude"}]'
35373530
)
3538-
expected_parts = [{"type": "text", "content": "Hi!"}]
35393531
assert json.loads(span["attributes"][SPANDATA.GEN_AI_OUTPUT_MESSAGES]) == [
3540-
{"role": "assistant", "parts": expected_parts}
3532+
{"role": "assistant", "parts": [{"type": "text", "content": "Hi!"}]}
35413533
]
35423534

35433535
assert span["attributes"][SPANDATA.GEN_AI_USAGE_INPUT_TOKENS] == 10
@@ -3582,9 +3574,8 @@ async def test_streaming_create_message_async_close(
35823574
span["data"][SPANDATA.GEN_AI_REQUEST_MESSAGES]
35833575
== '[{"role": "user", "content": "Hello, Claude"}]'
35843576
)
3585-
expected_parts = [{"type": "text", "content": "Hi!"}]
35863577
assert json.loads(span["data"][SPANDATA.GEN_AI_OUTPUT_MESSAGES]) == [
3587-
{"role": "assistant", "parts": expected_parts}
3578+
{"role": "assistant", "parts": [{"type": "text", "content": "Hi!"}]}
35883579
]
35893580

35903581
assert span["data"][SPANDATA.GEN_AI_USAGE_INPUT_TOKENS] == 10
@@ -4453,9 +4444,8 @@ async def test_stream_messages_async_close(
44534444
span["attributes"][SPANDATA.GEN_AI_REQUEST_MESSAGES]
44544445
== '[{"role": "user", "content": "Hello, Claude"}]'
44554446
)
4456-
expected_parts = [{"type": "text", "content": "Hi!"}]
44574447
assert json.loads(span["attributes"][SPANDATA.GEN_AI_OUTPUT_MESSAGES]) == [
4458-
{"role": "assistant", "parts": expected_parts}
4448+
{"role": "assistant", "parts": [{"type": "text", "content": "Hi!"}]}
44594449
]
44604450

44614451
assert span["attributes"][SPANDATA.GEN_AI_USAGE_INPUT_TOKENS] == 10
@@ -4506,9 +4496,8 @@ async def test_stream_messages_async_close(
45064496
span["attributes"][SPANDATA.GEN_AI_REQUEST_MESSAGES]
45074497
== '[{"role": "user", "content": "Hello, Claude"}]'
45084498
)
4509-
expected_parts = [{"type": "text", "content": "Hi!"}]
45104499
assert json.loads(span["attributes"][SPANDATA.GEN_AI_OUTPUT_MESSAGES]) == [
4511-
{"role": "assistant", "parts": expected_parts}
4500+
{"role": "assistant", "parts": [{"type": "text", "content": "Hi!"}]}
45124501
]
45134502

45144503
assert span["attributes"][SPANDATA.GEN_AI_USAGE_INPUT_TOKENS] == 10
@@ -4561,9 +4550,8 @@ async def test_stream_messages_async_close(
45614550
span["data"][SPANDATA.GEN_AI_REQUEST_MESSAGES]
45624551
== '[{"role": "user", "content": "Hello, Claude"}]'
45634552
)
4564-
expected_parts = [{"type": "text", "content": "Hi!"}]
45654553
assert json.loads(span["data"][SPANDATA.GEN_AI_OUTPUT_MESSAGES]) == [
4566-
{"role": "assistant", "parts": expected_parts}
4554+
{"role": "assistant", "parts": [{"type": "text", "content": "Hi!"}]}
45674555
]
45684556

45694557
assert span["data"][SPANDATA.GEN_AI_USAGE_INPUT_TOKENS] == 10

0 commit comments

Comments
 (0)