mirror of
https://github.com/anthropics/claude-code-sdk-python.git
synced 2025-07-07 14:45:00 +00:00
Fix tests to match updated ResultMessage type
- Remove cost_usd field from test expectations - Update to use total_cost_usd instead of total_cost - All 30 tests now pass 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
6cc5b34d54
commit
b3448f4baa
3 changed files with 5 additions and 9 deletions
|
@ -88,13 +88,12 @@ class TestQueryFunction:
|
||||||
yield {
|
yield {
|
||||||
"type": "result",
|
"type": "result",
|
||||||
"subtype": "success",
|
"subtype": "success",
|
||||||
"cost_usd": 0.001,
|
|
||||||
"duration_ms": 1000,
|
"duration_ms": 1000,
|
||||||
"duration_api_ms": 800,
|
"duration_api_ms": 800,
|
||||||
"is_error": False,
|
"is_error": False,
|
||||||
"num_turns": 1,
|
"num_turns": 1,
|
||||||
"session_id": "test-session",
|
"session_id": "test-session",
|
||||||
"total_cost": 0.001,
|
"total_cost_usd": 0.001,
|
||||||
}
|
}
|
||||||
|
|
||||||
mock_transport.receive_messages = mock_receive
|
mock_transport.receive_messages = mock_receive
|
||||||
|
|
|
@ -43,13 +43,12 @@ class TestIntegration:
|
||||||
yield {
|
yield {
|
||||||
"type": "result",
|
"type": "result",
|
||||||
"subtype": "success",
|
"subtype": "success",
|
||||||
"cost_usd": 0.001,
|
|
||||||
"duration_ms": 1000,
|
"duration_ms": 1000,
|
||||||
"duration_api_ms": 800,
|
"duration_api_ms": 800,
|
||||||
"is_error": False,
|
"is_error": False,
|
||||||
"num_turns": 1,
|
"num_turns": 1,
|
||||||
"session_id": "test-session",
|
"session_id": "test-session",
|
||||||
"total_cost": 0.001,
|
"total_cost_usd": 0.001,
|
||||||
}
|
}
|
||||||
|
|
||||||
mock_transport.receive_messages = mock_receive
|
mock_transport.receive_messages = mock_receive
|
||||||
|
@ -71,7 +70,7 @@ class TestIntegration:
|
||||||
|
|
||||||
# Check result message
|
# Check result message
|
||||||
assert isinstance(messages[1], ResultMessage)
|
assert isinstance(messages[1], ResultMessage)
|
||||||
assert messages[1].cost_usd == 0.001
|
assert messages[1].total_cost_usd == 0.001
|
||||||
assert messages[1].session_id == "test-session"
|
assert messages[1].session_id == "test-session"
|
||||||
|
|
||||||
anyio.run(_test)
|
anyio.run(_test)
|
||||||
|
@ -109,13 +108,12 @@ class TestIntegration:
|
||||||
yield {
|
yield {
|
||||||
"type": "result",
|
"type": "result",
|
||||||
"subtype": "success",
|
"subtype": "success",
|
||||||
"cost_usd": 0.002,
|
|
||||||
"duration_ms": 1500,
|
"duration_ms": 1500,
|
||||||
"duration_api_ms": 1200,
|
"duration_api_ms": 1200,
|
||||||
"is_error": False,
|
"is_error": False,
|
||||||
"num_turns": 1,
|
"num_turns": 1,
|
||||||
"session_id": "test-session-2",
|
"session_id": "test-session-2",
|
||||||
"total_cost": 0.002,
|
"total_cost_usd": 0.002,
|
||||||
}
|
}
|
||||||
|
|
||||||
mock_transport.receive_messages = mock_receive
|
mock_transport.receive_messages = mock_receive
|
||||||
|
|
|
@ -45,7 +45,6 @@ class TestMessageTypes:
|
||||||
"""Test creating a ResultMessage."""
|
"""Test creating a ResultMessage."""
|
||||||
msg = ResultMessage(
|
msg = ResultMessage(
|
||||||
subtype="success",
|
subtype="success",
|
||||||
cost_usd=0.01,
|
|
||||||
duration_ms=1500,
|
duration_ms=1500,
|
||||||
duration_api_ms=1200,
|
duration_api_ms=1200,
|
||||||
is_error=False,
|
is_error=False,
|
||||||
|
@ -54,7 +53,7 @@ class TestMessageTypes:
|
||||||
total_cost_usd=0.01,
|
total_cost_usd=0.01,
|
||||||
)
|
)
|
||||||
assert msg.subtype == "success"
|
assert msg.subtype == "success"
|
||||||
assert msg.cost_usd == 0.01
|
assert msg.total_cost_usd == 0.01
|
||||||
assert msg.session_id == "session-123"
|
assert msg.session_id == "session-123"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue