test: add assertions for have_forced_answer state (#1815)

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2024-12-29 15:52:48 +00:00
parent 625a807d29
commit 0d8f7114ba
2 changed files with 5 additions and 1 deletions

View File

@@ -466,6 +466,8 @@ def test_agent_custom_max_iterations():
tools=[get_final_answer],
)
assert private_mock.call_count == 2
# Verify that have_forced_answer was set to True after max iterations
assert agent.agent_executor.have_forced_answer == True, "have_forced_answer should be True after max iterations"
@pytest.mark.vcr(filter_headers=["authorization"])
@@ -566,6 +568,8 @@ def test_agent_moved_on_after_max_iterations():
tools=[get_final_answer],
)
assert output == "The final answer is 42."
# Verify that have_forced_answer was set to True after max iterations
assert agent.agent_executor.have_forced_answer == True, "have_forced_answer should be True after max iterations"
@pytest.mark.vcr(filter_headers=["authorization"])

View File

@@ -3125,4 +3125,4 @@ def test_multimodal_agent_live_image_analysis():
# Verify we got a meaningful response
assert isinstance(result.raw, str)
assert len(result.raw) > 100 # Expecting a detailed analysis
assert "error" not in result.raw.lower() # No error messages in response
assert "error" not in result.raw.lower() # No error messages in response