Skip to content

Commit 87520b0

Browse files
committed
patch up tests
1 parent 3e49696 commit 87520b0

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

examples/memory/advanced_session_advanced_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async def main():
2727
)
2828

2929
# Create a advanced session instance
30-
session = AdvancedSQLiteSession("conversation_advanced")
30+
session = AdvancedSQLiteSession(session_id="conversation_advanced")
3131

3232
print("=== Advanced Session: Conversation Branching ===")
3333
print("This example demonstrates conversation editing and branching.\n")

examples/memory/advanced_session_basic_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async def main():
2727
)
2828

2929
# Create a advanced session instance
30-
session = AdvancedSQLiteSession("conversation_basic")
30+
session = AdvancedSQLiteSession(session_id="conversation_basic")
3131

3232
print("=== Basic Advanced Session Example ===")
3333
print("The agent will remember previous messages with structured tracking.\n")

tests/extensions/memory/test_advanced_sqlite_session.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def create_mock_run_result(
7878
async def test_advanced_session_basic_functionality(agent: Agent):
7979
"""Test basic AdvancedSQLiteSession functionality."""
8080
session_id = "advanced_test"
81-
session = AdvancedSQLiteSession(session_id)
81+
session = AdvancedSQLiteSession(session_id=session_id)
8282

8383
# Test basic session operations work
8484
items: list[TResponseInputItem] = [
@@ -99,7 +99,7 @@ async def test_advanced_session_basic_functionality(agent: Agent):
9999
async def test_message_structure_tracking(agent: Agent):
100100
"""Test that message structure is properly tracked."""
101101
session_id = "structure_test"
102-
session = AdvancedSQLiteSession(session_id)
102+
session = AdvancedSQLiteSession(session_id=session_id)
103103

104104
# Add various types of messages
105105
items: list[TResponseInputItem] = [
@@ -132,7 +132,7 @@ async def test_message_structure_tracking(agent: Agent):
132132
async def test_tool_usage_tracking(agent: Agent):
133133
"""Test tool usage tracking functionality."""
134134
session_id = "tools_test"
135-
session = AdvancedSQLiteSession(session_id)
135+
session = AdvancedSQLiteSession(session_id=session_id)
136136

137137
# Add items with tool calls
138138
items: list[TResponseInputItem] = [
@@ -159,7 +159,7 @@ async def test_tool_usage_tracking(agent: Agent):
159159
async def test_soft_deletion_functionality(agent: Agent):
160160
"""Test soft deletion and reactivation functionality."""
161161
session_id = "deletion_test"
162-
session = AdvancedSQLiteSession(session_id)
162+
session = AdvancedSQLiteSession(session_id=session_id)
163163

164164
# Add multiple turns
165165
turn_1_items: list[TResponseInputItem] = [
@@ -212,7 +212,7 @@ async def test_soft_deletion_functionality(agent: Agent):
212212
async def test_usage_tracking_storage(agent: Agent, usage_data: Usage):
213213
"""Test usage data storage and retrieval."""
214214
session_id = "usage_test"
215-
session = AdvancedSQLiteSession(session_id)
215+
session = AdvancedSQLiteSession(session_id=session_id)
216216

217217
# Simulate adding items for turn 1 to increment turn counter
218218
await session.add_items([{"role": "user", "content": "First turn"}])
@@ -271,7 +271,7 @@ async def test_usage_tracking_storage(agent: Agent, usage_data: Usage):
271271
async def test_runner_integration_with_usage_tracking(agent: Agent):
272272
"""Test integration with Runner and automatic usage tracking pattern."""
273273
session_id = "integration_test"
274-
session = AdvancedSQLiteSession(session_id)
274+
session = AdvancedSQLiteSession(session_id=session_id)
275275

276276
async def store_session_usage(result: Any, session: AdvancedSQLiteSession):
277277
"""Helper function to store usage after runner completes."""
@@ -319,7 +319,7 @@ async def store_session_usage(result: Any, session: AdvancedSQLiteSession):
319319
async def test_sequence_ordering():
320320
"""Test that sequence ordering works correctly even with same timestamps."""
321321
session_id = "sequence_test"
322-
session = AdvancedSQLiteSession(session_id)
322+
session = AdvancedSQLiteSession(session_id=session_id)
323323

324324
# Add multiple items quickly to test sequence ordering
325325
items: list[TResponseInputItem] = [
@@ -344,7 +344,7 @@ async def test_sequence_ordering():
344344
async def test_conversation_structure_with_multiple_turns():
345345
"""Test conversation structure tracking with multiple user turns."""
346346
session_id = "multi_turn_test"
347-
session = AdvancedSQLiteSession(session_id)
347+
session = AdvancedSQLiteSession(session_id=session_id)
348348

349349
# Turn 1
350350
turn_1: list[TResponseInputItem] = [
@@ -395,7 +395,7 @@ async def test_conversation_structure_with_multiple_turns():
395395
async def test_empty_session_operations():
396396
"""Test operations on empty sessions."""
397397
session_id = "empty_test"
398-
session = AdvancedSQLiteSession(session_id)
398+
session = AdvancedSQLiteSession(session_id=session_id)
399399

400400
# Test getting items from empty session
401401
items = await session.get_items()
@@ -423,7 +423,7 @@ async def test_empty_session_operations():
423423
async def test_json_serialization_edge_cases(usage_data: Usage):
424424
"""Test edge cases in JSON serialization of usage data."""
425425
session_id = "json_test"
426-
session = AdvancedSQLiteSession(session_id)
426+
session = AdvancedSQLiteSession(session_id=session_id)
427427

428428
# Test with normal usage data (need to add user message first to create turn)
429429
await session.add_items([{"role": "user", "content": "First test"}])
@@ -463,8 +463,8 @@ async def test_json_serialization_edge_cases(usage_data: Usage):
463463

464464
async def test_session_isolation():
465465
"""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")
468468

469469
# Add data to session 1
470470
await session1.add_items([{"role": "user", "content": "Session 1 message"}])
@@ -495,7 +495,7 @@ async def test_session_isolation():
495495
async def test_error_handling_in_usage_tracking(usage_data: Usage):
496496
"""Test that usage tracking errors don't break the main flow."""
497497
session_id = "error_test"
498-
session = AdvancedSQLiteSession(session_id)
498+
session = AdvancedSQLiteSession(session_id=session_id)
499499

500500
# Test normal operation
501501
run_result = create_mock_run_result(usage_data)
@@ -511,7 +511,7 @@ async def test_error_handling_in_usage_tracking(usage_data: Usage):
511511
async def test_tool_name_extraction():
512512
"""Test that tool names are correctly extracted from different item types."""
513513
session_id = "tool_names_test"
514-
session = AdvancedSQLiteSession(session_id)
514+
session = AdvancedSQLiteSession(session_id=session_id)
515515

516516
# Add items with different ways of specifying tool names
517517
items: list[TResponseInputItem] = [
@@ -538,7 +538,7 @@ async def test_tool_name_extraction():
538538
async def test_tool_execution_integration(agent: Agent):
539539
"""Test integration with actual tool execution."""
540540
session_id = "tool_integration_test"
541-
session = AdvancedSQLiteSession(session_id)
541+
session = AdvancedSQLiteSession(session_id=session_id)
542542

543543
# Set up the fake model to trigger a tool call
544544
fake_model = cast(FakeModel, agent.model)

0 commit comments

Comments
 (0)