@@ -78,7 +78,7 @@ def create_mock_run_result(
78
78
async def test_advanced_session_basic_functionality (agent : Agent ):
79
79
"""Test basic AdvancedSQLiteSession functionality."""
80
80
session_id = "advanced_test"
81
- session = AdvancedSQLiteSession (session_id )
81
+ session = AdvancedSQLiteSession (session_id = session_id )
82
82
83
83
# Test basic session operations work
84
84
items : list [TResponseInputItem ] = [
@@ -99,7 +99,7 @@ async def test_advanced_session_basic_functionality(agent: Agent):
99
99
async def test_message_structure_tracking (agent : Agent ):
100
100
"""Test that message structure is properly tracked."""
101
101
session_id = "structure_test"
102
- session = AdvancedSQLiteSession (session_id )
102
+ session = AdvancedSQLiteSession (session_id = session_id )
103
103
104
104
# Add various types of messages
105
105
items : list [TResponseInputItem ] = [
@@ -132,7 +132,7 @@ async def test_message_structure_tracking(agent: Agent):
132
132
async def test_tool_usage_tracking (agent : Agent ):
133
133
"""Test tool usage tracking functionality."""
134
134
session_id = "tools_test"
135
- session = AdvancedSQLiteSession (session_id )
135
+ session = AdvancedSQLiteSession (session_id = session_id )
136
136
137
137
# Add items with tool calls
138
138
items : list [TResponseInputItem ] = [
@@ -159,7 +159,7 @@ async def test_tool_usage_tracking(agent: Agent):
159
159
async def test_soft_deletion_functionality (agent : Agent ):
160
160
"""Test soft deletion and reactivation functionality."""
161
161
session_id = "deletion_test"
162
- session = AdvancedSQLiteSession (session_id )
162
+ session = AdvancedSQLiteSession (session_id = session_id )
163
163
164
164
# Add multiple turns
165
165
turn_1_items : list [TResponseInputItem ] = [
@@ -212,7 +212,7 @@ async def test_soft_deletion_functionality(agent: Agent):
212
212
async def test_usage_tracking_storage (agent : Agent , usage_data : Usage ):
213
213
"""Test usage data storage and retrieval."""
214
214
session_id = "usage_test"
215
- session = AdvancedSQLiteSession (session_id )
215
+ session = AdvancedSQLiteSession (session_id = session_id )
216
216
217
217
# Simulate adding items for turn 1 to increment turn counter
218
218
await session .add_items ([{"role" : "user" , "content" : "First turn" }])
@@ -271,7 +271,7 @@ async def test_usage_tracking_storage(agent: Agent, usage_data: Usage):
271
271
async def test_runner_integration_with_usage_tracking (agent : Agent ):
272
272
"""Test integration with Runner and automatic usage tracking pattern."""
273
273
session_id = "integration_test"
274
- session = AdvancedSQLiteSession (session_id )
274
+ session = AdvancedSQLiteSession (session_id = session_id )
275
275
276
276
async def store_session_usage (result : Any , session : AdvancedSQLiteSession ):
277
277
"""Helper function to store usage after runner completes."""
@@ -319,7 +319,7 @@ async def store_session_usage(result: Any, session: AdvancedSQLiteSession):
319
319
async def test_sequence_ordering ():
320
320
"""Test that sequence ordering works correctly even with same timestamps."""
321
321
session_id = "sequence_test"
322
- session = AdvancedSQLiteSession (session_id )
322
+ session = AdvancedSQLiteSession (session_id = session_id )
323
323
324
324
# Add multiple items quickly to test sequence ordering
325
325
items : list [TResponseInputItem ] = [
@@ -344,7 +344,7 @@ async def test_sequence_ordering():
344
344
async def test_conversation_structure_with_multiple_turns ():
345
345
"""Test conversation structure tracking with multiple user turns."""
346
346
session_id = "multi_turn_test"
347
- session = AdvancedSQLiteSession (session_id )
347
+ session = AdvancedSQLiteSession (session_id = session_id )
348
348
349
349
# Turn 1
350
350
turn_1 : list [TResponseInputItem ] = [
@@ -395,7 +395,7 @@ async def test_conversation_structure_with_multiple_turns():
395
395
async def test_empty_session_operations ():
396
396
"""Test operations on empty sessions."""
397
397
session_id = "empty_test"
398
- session = AdvancedSQLiteSession (session_id )
398
+ session = AdvancedSQLiteSession (session_id = session_id )
399
399
400
400
# Test getting items from empty session
401
401
items = await session .get_items ()
@@ -423,7 +423,7 @@ async def test_empty_session_operations():
423
423
async def test_json_serialization_edge_cases (usage_data : Usage ):
424
424
"""Test edge cases in JSON serialization of usage data."""
425
425
session_id = "json_test"
426
- session = AdvancedSQLiteSession (session_id )
426
+ session = AdvancedSQLiteSession (session_id = session_id )
427
427
428
428
# Test with normal usage data (need to add user message first to create turn)
429
429
await session .add_items ([{"role" : "user" , "content" : "First test" }])
@@ -463,8 +463,8 @@ async def test_json_serialization_edge_cases(usage_data: Usage):
463
463
464
464
async def test_session_isolation ():
465
465
"""Test that different session IDs maintain separate data."""
466
- session1 = AdvancedSQLiteSession ("session_1" )
467
- session2 = AdvancedSQLiteSession ("session_2" )
466
+ session1 = AdvancedSQLiteSession (session_id = "session_1" )
467
+ session2 = AdvancedSQLiteSession (session_id = "session_2" )
468
468
469
469
# Add data to session 1
470
470
await session1 .add_items ([{"role" : "user" , "content" : "Session 1 message" }])
@@ -495,7 +495,7 @@ async def test_session_isolation():
495
495
async def test_error_handling_in_usage_tracking (usage_data : Usage ):
496
496
"""Test that usage tracking errors don't break the main flow."""
497
497
session_id = "error_test"
498
- session = AdvancedSQLiteSession (session_id )
498
+ session = AdvancedSQLiteSession (session_id = session_id )
499
499
500
500
# Test normal operation
501
501
run_result = create_mock_run_result (usage_data )
@@ -511,7 +511,7 @@ async def test_error_handling_in_usage_tracking(usage_data: Usage):
511
511
async def test_tool_name_extraction ():
512
512
"""Test that tool names are correctly extracted from different item types."""
513
513
session_id = "tool_names_test"
514
- session = AdvancedSQLiteSession (session_id )
514
+ session = AdvancedSQLiteSession (session_id = session_id )
515
515
516
516
# Add items with different ways of specifying tool names
517
517
items : list [TResponseInputItem ] = [
@@ -538,7 +538,7 @@ async def test_tool_name_extraction():
538
538
async def test_tool_execution_integration (agent : Agent ):
539
539
"""Test integration with actual tool execution."""
540
540
session_id = "tool_integration_test"
541
- session = AdvancedSQLiteSession (session_id )
541
+ session = AdvancedSQLiteSession (session_id = session_id )
542
542
543
543
# Set up the fake model to trigger a tool call
544
544
fake_model = cast (FakeModel , agent .model )
0 commit comments