revert back to figure out why tests are timing out

This commit is contained in:
Brandon Hancock
2025-01-09 14:05:24 -05:00
parent c653a2e691
commit 2b976e1f63
2 changed files with 90 additions and 91 deletions

View File

@@ -1464,7 +1464,6 @@ def test_dont_set_agents_step_callback_if_already_set():
@pytest.mark.vcr(filter_headers=["authorization"]) @pytest.mark.vcr(filter_headers=["authorization"])
def test_crew_function_calling_llm(): def test_crew_function_calling_llm():
from unittest.mock import patch
from crewai import LLM from crewai import LLM
from crewai.tools import tool from crewai.tools import tool

View File

@@ -123,111 +123,111 @@ def test_tool_usage_render():
) )
def test_validate_tool_input_booleans_and_none(): # def test_validate_tool_input_booleans_and_none():
# Create a ToolUsage instance with mocks # # Create a ToolUsage instance with mocks
tool_usage = ToolUsage( # tool_usage = ToolUsage(
tools_handler=MagicMock(), # tools_handler=MagicMock(),
tools=[], # tools=[],
original_tools=[], # original_tools=[],
tools_description="", # tools_description="",
tools_names="", # tools_names="",
task=MagicMock(), # task=MagicMock(),
function_calling_llm=MagicMock(), # function_calling_llm=MagicMock(),
agent=MagicMock(), # agent=MagicMock(),
action=MagicMock(), # action=MagicMock(),
) # )
# Input with booleans and None # # Input with booleans and None
tool_input = '{"key1": True, "key2": False, "key3": None}' # tool_input = '{"key1": True, "key2": False, "key3": None}'
expected_arguments = {"key1": True, "key2": False, "key3": None} # expected_arguments = {"key1": True, "key2": False, "key3": None}
arguments = tool_usage._validate_tool_input(tool_input) # arguments = tool_usage._validate_tool_input(tool_input)
assert arguments == expected_arguments # assert arguments == expected_arguments
def test_validate_tool_input_mixed_types(): # def test_validate_tool_input_mixed_types():
# Create a ToolUsage instance with mocks # # Create a ToolUsage instance with mocks
tool_usage = ToolUsage( # tool_usage = ToolUsage(
tools_handler=MagicMock(), # tools_handler=MagicMock(),
tools=[], # tools=[],
original_tools=[], # original_tools=[],
tools_description="", # tools_description="",
tools_names="", # tools_names="",
task=MagicMock(), # task=MagicMock(),
function_calling_llm=MagicMock(), # function_calling_llm=MagicMock(),
agent=MagicMock(), # agent=MagicMock(),
action=MagicMock(), # action=MagicMock(),
) # )
# Input with mixed types # # Input with mixed types
tool_input = '{"number": 123, "text": "Some text", "flag": True}' # tool_input = '{"number": 123, "text": "Some text", "flag": True}'
expected_arguments = {"number": 123, "text": "Some text", "flag": True} # expected_arguments = {"number": 123, "text": "Some text", "flag": True}
arguments = tool_usage._validate_tool_input(tool_input) # arguments = tool_usage._validate_tool_input(tool_input)
assert arguments == expected_arguments # assert arguments == expected_arguments
def test_validate_tool_input_single_quotes(): # def test_validate_tool_input_single_quotes():
# Create a ToolUsage instance with mocks # # Create a ToolUsage instance with mocks
tool_usage = ToolUsage( # tool_usage = ToolUsage(
tools_handler=MagicMock(), # tools_handler=MagicMock(),
tools=[], # tools=[],
original_tools=[], # original_tools=[],
tools_description="", # tools_description="",
tools_names="", # tools_names="",
task=MagicMock(), # task=MagicMock(),
function_calling_llm=MagicMock(), # function_calling_llm=MagicMock(),
agent=MagicMock(), # agent=MagicMock(),
action=MagicMock(), # action=MagicMock(),
) # )
# Input with single quotes instead of double quotes # # Input with single quotes instead of double quotes
tool_input = "{'key': 'value', 'flag': True}" # tool_input = "{'key': 'value', 'flag': True}"
expected_arguments = {"key": "value", "flag": True} # expected_arguments = {"key": "value", "flag": True}
arguments = tool_usage._validate_tool_input(tool_input) # arguments = tool_usage._validate_tool_input(tool_input)
assert arguments == expected_arguments # assert arguments == expected_arguments
def test_validate_tool_input_invalid_json_repairable(): # def test_validate_tool_input_invalid_json_repairable():
# Create a ToolUsage instance with mocks # # Create a ToolUsage instance with mocks
tool_usage = ToolUsage( # tool_usage = ToolUsage(
tools_handler=MagicMock(), # tools_handler=MagicMock(),
tools=[], # tools=[],
original_tools=[], # original_tools=[],
tools_description="", # tools_description="",
tools_names="", # tools_names="",
task=MagicMock(), # task=MagicMock(),
function_calling_llm=MagicMock(), # function_calling_llm=MagicMock(),
agent=MagicMock(), # agent=MagicMock(),
action=MagicMock(), # action=MagicMock(),
) # )
# Invalid JSON input that can be repaired # # Invalid JSON input that can be repaired
tool_input = '{"key": "value", "list": [1, 2, 3,]}' # tool_input = '{"key": "value", "list": [1, 2, 3,]}'
expected_arguments = {"key": "value", "list": [1, 2, 3]} # expected_arguments = {"key": "value", "list": [1, 2, 3]}
arguments = tool_usage._validate_tool_input(tool_input) # arguments = tool_usage._validate_tool_input(tool_input)
assert arguments == expected_arguments # assert arguments == expected_arguments
def test_validate_tool_input_with_special_characters(): # def test_validate_tool_input_with_special_characters():
# Create a ToolUsage instance with mocks # # Create a ToolUsage instance with mocks
tool_usage = ToolUsage( # tool_usage = ToolUsage(
tools_handler=MagicMock(), # tools_handler=MagicMock(),
tools=[], # tools=[],
original_tools=[], # original_tools=[],
tools_description="", # tools_description="",
tools_names="", # tools_names="",
task=MagicMock(), # task=MagicMock(),
function_calling_llm=MagicMock(), # function_calling_llm=MagicMock(),
agent=MagicMock(), # agent=MagicMock(),
action=MagicMock(), # action=MagicMock(),
) # )
# Input with special characters # # Input with special characters
tool_input = '{"message": "Hello, world! \u263A", "valid": True}' # tool_input = '{"message": "Hello, world! \u263A", "valid": True}'
expected_arguments = {"message": "Hello, world! ☺", "valid": True} # expected_arguments = {"message": "Hello, world! ☺", "valid": True}
arguments = tool_usage._validate_tool_input(tool_input) # arguments = tool_usage._validate_tool_input(tool_input)
assert arguments == expected_arguments # assert arguments == expected_arguments