Skip to content

Commit b3448f4

Browse files
ltawfikclaude
andcommitted
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 <[email protected]>
1 parent 6cc5b34 commit b3448f4

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

tests/test_client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,12 @@ async def mock_receive():
8888
yield {
8989
"type": "result",
9090
"subtype": "success",
91-
"cost_usd": 0.001,
9291
"duration_ms": 1000,
9392
"duration_api_ms": 800,
9493
"is_error": False,
9594
"num_turns": 1,
9695
"session_id": "test-session",
97-
"total_cost": 0.001,
96+
"total_cost_usd": 0.001,
9897
}
9998

10099
mock_transport.receive_messages = mock_receive

tests/test_integration.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@ async def mock_receive():
4343
yield {
4444
"type": "result",
4545
"subtype": "success",
46-
"cost_usd": 0.001,
4746
"duration_ms": 1000,
4847
"duration_api_ms": 800,
4948
"is_error": False,
5049
"num_turns": 1,
5150
"session_id": "test-session",
52-
"total_cost": 0.001,
51+
"total_cost_usd": 0.001,
5352
}
5453

5554
mock_transport.receive_messages = mock_receive
@@ -71,7 +70,7 @@ async def mock_receive():
7170

7271
# Check result message
7372
assert isinstance(messages[1], ResultMessage)
74-
assert messages[1].cost_usd == 0.001
73+
assert messages[1].total_cost_usd == 0.001
7574
assert messages[1].session_id == "test-session"
7675

7776
anyio.run(_test)
@@ -109,13 +108,12 @@ async def mock_receive():
109108
yield {
110109
"type": "result",
111110
"subtype": "success",
112-
"cost_usd": 0.002,
113111
"duration_ms": 1500,
114112
"duration_api_ms": 1200,
115113
"is_error": False,
116114
"num_turns": 1,
117115
"session_id": "test-session-2",
118-
"total_cost": 0.002,
116+
"total_cost_usd": 0.002,
119117
}
120118

121119
mock_transport.receive_messages = mock_receive

tests/test_types.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def test_result_message(self):
4545
"""Test creating a ResultMessage."""
4646
msg = ResultMessage(
4747
subtype="success",
48-
cost_usd=0.01,
4948
duration_ms=1500,
5049
duration_api_ms=1200,
5150
is_error=False,
@@ -54,7 +53,7 @@ def test_result_message(self):
5453
total_cost_usd=0.01,
5554
)
5655
assert msg.subtype == "success"
57-
assert msg.cost_usd == 0.01
56+
assert msg.total_cost_usd == 0.01
5857
assert msg.session_id == "session-123"
5958

6059

0 commit comments

Comments
 (0)