Skip to content

Commit

Permalink
Add a unit test for the getter
Browse files Browse the repository at this point in the history
  • Loading branch information
markbackman committed Feb 1, 2025
1 parent 70a300d commit cb34b5b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,3 +1094,26 @@ async def test_transition_configuration_exclusivity(self):
self.assertIn(
"cannot have both transition_to and transition_callback", str(context.exception)
)

async def test_get_current_context(self):
"""Test getting current conversation context."""
flow_manager = FlowManager(
task=self.mock_task,
llm=self.mock_llm,
context_aggregator=self.mock_context_aggregator,
)
await flow_manager.initialize()

# Mock the context messages
mock_messages = [{"role": "system", "content": "Test message"}]
self.mock_context_aggregator.user()._context.messages = mock_messages

# Test getting context
context = flow_manager.get_current_context()
self.assertEqual(context, mock_messages)

# Test error when context aggregator is not available
flow_manager._context_aggregator = None
with self.assertRaises(FlowError) as context:
flow_manager.get_current_context()
self.assertIn("No context aggregator available", str(context.exception))

0 comments on commit cb34b5b

Please sign in to comment.