Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
roaga committed Nov 2, 2024
1 parent 0cf6ab4 commit 6ee0fa0
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/automation/autofix/test_autofix_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,33 @@ def test_should_continue_normal_case(autofix_agent, run_config):
assert autofix_agent.should_continue(run_config)


def test_should_continue_returns_false_when_max_iterations_reached(autofix_agent, run_config):
autofix_agent.iterations = run_config.max_iterations
autofix_agent.memory = [Message(role="user", content="You're great when you work")]
with autofix_agent.context.state.update() as state:
state.steps = [DefaultStep(status=AutofixStatus.PROCESSING, key="test", title="Test")]
assert not autofix_agent.should_continue(run_config)


def test_should_continue_returns_false_with_stop_message(autofix_agent, run_config):
run_config.stop_message = "STOP"
autofix_agent.memory = [Message(role="assistant", content="Let's STOP here")]
autofix_agent.iterations = 1
with autofix_agent.context.state.update() as state:
state.steps = [DefaultStep(status=AutofixStatus.PROCESSING, key="test", title="Test")]
assert not autofix_agent.should_continue(run_config)


def test_should_continue_returns_false_when_assistant_message_has_no_tool_calls(
autofix_agent, run_config
):
autofix_agent.memory = [Message(role="assistant", content="All done!")]
autofix_agent.iterations = 1
with autofix_agent.context.state.update() as state:
state.steps = [DefaultStep(status=AutofixStatus.PROCESSING, key="test", title="Test")]
assert not autofix_agent.should_continue(run_config)


@patch("seer.automation.autofix.autofix_agent.AutofixAgent.get_completion")
def test_run_iteration_with_queued_user_messages(
mock_get_completion,
Expand Down

0 comments on commit 6ee0fa0

Please sign in to comment.