Apply automatic linting fixes to tests directory

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-05-12 13:31:07 +00:00
parent ad1ea46bbb
commit 46621113af
62 changed files with 1738 additions and 1821 deletions

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, List, Optional
from typing import Any
import pytest
from pydantic import BaseModel
@@ -12,7 +12,7 @@ from crewai.utilities.token_counter_callback import TokenProcess
# Concrete implementation for testing
class ConcreteAgentAdapter(BaseAgentAdapter):
def configure_tools(
self, tools: Optional[List[BaseTool]] = None, **kwargs: Any
self, tools: list[BaseTool] | None = None, **kwargs: Any,
) -> None:
# Simple implementation for testing
self.tools = tools or []
@@ -20,35 +20,35 @@ class ConcreteAgentAdapter(BaseAgentAdapter):
def execute_task(
self,
task: Any,
context: Optional[str] = None,
tools: Optional[List[Any]] = None,
context: str | None = None,
tools: list[Any] | None = None,
) -> str:
# Dummy implementation needed due to BaseAgent inheritance
return "Task executed"
def create_agent_executor(self, tools: Optional[List[BaseTool]] = None) -> Any:
def create_agent_executor(self, tools: list[BaseTool] | None = None) -> Any:
# Dummy implementation
return None
def get_delegation_tools(
self, tools: List[BaseTool], tool_map: Optional[Dict[str, BaseTool]]
) -> List[BaseTool]:
self, tools: list[BaseTool], tool_map: dict[str, BaseTool] | None,
) -> list[BaseTool]:
# Dummy implementation
return []
def _parse_output(self, agent_output: Any, token_process: TokenProcess):
def _parse_output(self, agent_output: Any, token_process: TokenProcess) -> None:
# Dummy implementation
pass
def get_output_converter(self, tools: Optional[List[BaseTool]] = None) -> Any:
def get_output_converter(self, tools: list[BaseTool] | None = None) -> Any:
# Dummy implementation
return None
def test_base_agent_adapter_initialization():
def test_base_agent_adapter_initialization() -> None:
"""Test initialization of the concrete agent adapter."""
adapter = ConcreteAgentAdapter(
role="test role", goal="test goal", backstory="test backstory"
role="test role", goal="test goal", backstory="test backstory",
)
assert isinstance(adapter, BaseAgent)
assert isinstance(adapter, BaseAgentAdapter)
@@ -57,7 +57,7 @@ def test_base_agent_adapter_initialization():
assert adapter.adapted_structured_output is False
def test_base_agent_adapter_initialization_with_config():
def test_base_agent_adapter_initialization_with_config() -> None:
"""Test initialization with agent_config."""
config = {"model": "gpt-4"}
adapter = ConcreteAgentAdapter(
@@ -69,10 +69,10 @@ def test_base_agent_adapter_initialization_with_config():
assert adapter._agent_config == config
def test_configure_tools_method_exists():
def test_configure_tools_method_exists() -> None:
"""Test that configure_tools method exists and can be called."""
adapter = ConcreteAgentAdapter(
role="test role", goal="test goal", backstory="test backstory"
role="test role", goal="test goal", backstory="test backstory",
)
# Create dummy tools if needed, or pass None
tools = []
@@ -81,10 +81,10 @@ def test_configure_tools_method_exists():
assert adapter.tools == tools
def test_configure_structured_output_method_exists():
def test_configure_structured_output_method_exists() -> None:
"""Test that configure_structured_output method exists and can be called."""
adapter = ConcreteAgentAdapter(
role="test role", goal="test goal", backstory="test backstory"
role="test role", goal="test goal", backstory="test backstory",
)
# Define a dummy structure or pass None/Any
@@ -95,10 +95,9 @@ def test_configure_structured_output_method_exists():
adapter.configure_structured_output(structured_output)
# Add assertions here if configure_structured_output modifies state
# For now, just ensuring it runs without error is sufficient
pass
def test_base_agent_adapter_inherits_base_agent():
def test_base_agent_adapter_inherits_base_agent() -> None:
"""Test that BaseAgentAdapter inherits from BaseAgent."""
assert issubclass(BaseAgentAdapter, BaseAgent)
@@ -107,7 +106,7 @@ class ConcreteAgentAdapterWithoutRequiredMethods(BaseAgentAdapter):
pass
def test_base_agent_adapter_fails_without_required_methods():
def test_base_agent_adapter_fails_without_required_methods() -> None:
"""Test that BaseAgentAdapter fails without required methods."""
with pytest.raises(TypeError):
ConcreteAgentAdapterWithoutRequiredMethods() # type: ignore

View File

@@ -1,4 +1,3 @@
from typing import Any, List
from unittest.mock import Mock
import pytest
@@ -8,7 +7,7 @@ from crewai.tools.base_tool import BaseTool
class ConcreteToolAdapter(BaseToolAdapter):
def configure_tools(self, tools: List[BaseTool]) -> None:
def configure_tools(self, tools: list[BaseTool]) -> None:
self.converted_tools = [f"converted_{tool.name}" for tool in tools]
@@ -31,19 +30,19 @@ def tools_list(mock_tool_1, mock_tool_2):
return [mock_tool_1, mock_tool_2]
def test_initialization_with_tools(tools_list):
def test_initialization_with_tools(tools_list) -> None:
adapter = ConcreteToolAdapter(tools=tools_list)
assert adapter.original_tools == tools_list
assert adapter.converted_tools == [] # Conversion happens in configure_tools
def test_initialization_without_tools():
def test_initialization_without_tools() -> None:
adapter = ConcreteToolAdapter()
assert adapter.original_tools == []
assert adapter.converted_tools == []
def test_configure_tools(tools_list):
def test_configure_tools(tools_list) -> None:
adapter = ConcreteToolAdapter()
adapter.configure_tools(tools_list)
assert adapter.converted_tools == ["converted_Mock Tool 1", "converted_MockTool2"]
@@ -58,28 +57,28 @@ def test_configure_tools(tools_list):
assert adapter_with_init_tools.original_tools == tools_list
def test_tools_method(tools_list):
def test_tools_method(tools_list) -> None:
adapter = ConcreteToolAdapter()
adapter.configure_tools(tools_list)
assert adapter.tools() == ["converted_Mock Tool 1", "converted_MockTool2"]
def test_tools_method_empty():
def test_tools_method_empty() -> None:
adapter = ConcreteToolAdapter()
assert adapter.tools() == []
def test_sanitize_tool_name_with_spaces():
def test_sanitize_tool_name_with_spaces() -> None:
adapter = ConcreteToolAdapter()
assert adapter.sanitize_tool_name("Tool With Spaces") == "Tool_With_Spaces"
def test_sanitize_tool_name_without_spaces():
def test_sanitize_tool_name_without_spaces() -> None:
adapter = ConcreteToolAdapter()
assert adapter.sanitize_tool_name("ToolWithoutSpaces") == "ToolWithoutSpaces"
def test_sanitize_tool_name_empty():
def test_sanitize_tool_name_empty() -> None:
adapter = ConcreteToolAdapter()
assert adapter.sanitize_tool_name("") == ""
@@ -88,7 +87,7 @@ class ConcreteToolAdapterWithoutRequiredMethods(BaseToolAdapter):
pass
def test_tool_adapted_fails_without_required_methods():
def test_tool_adapted_fails_without_required_methods() -> None:
"""Test that BaseToolAdapter fails without required methods."""
with pytest.raises(TypeError):
ConcreteToolAdapterWithoutRequiredMethods() # type: ignore

View File

@@ -1,5 +1,5 @@
import hashlib
from typing import Any, List, Optional
from typing import Any
from pydantic import BaseModel
@@ -11,25 +11,25 @@ class MockAgent(BaseAgent):
def execute_task(
self,
task: Any,
context: Optional[str] = None,
tools: Optional[List[BaseTool]] = None,
context: str | None = None,
tools: list[BaseTool] | None = None,
) -> str:
return ""
def create_agent_executor(self, tools=None) -> None: ...
def get_delegation_tools(self, agents: List["BaseAgent"]): ...
def get_delegation_tools(self, agents: list["BaseAgent"]) -> None: ...
def get_output_converter(
self, llm: Any, text: str, model: type[BaseModel] | None, instructions: str
): ...
self, llm: Any, text: str, model: type[BaseModel] | None, instructions: str,
) -> None: ...
def test_key():
def test_key() -> None:
agent = MockAgent(
role="test role",
goal="test goal",
backstory="test backstory",
)
hash = hashlib.md5("test role|test goal|test backstory".encode()).hexdigest()
hash = hashlib.md5(b"test role|test goal|test backstory").hexdigest()
assert agent.key == hash

View File

@@ -11,11 +11,10 @@ from crewai.agents.parser import CrewAgentParser
@pytest.fixture
def parser():
agent = MockAgent()
p = CrewAgentParser(agent)
return p
return CrewAgentParser(agent)
def test_valid_action_parsing_special_characters(parser):
def test_valid_action_parsing_special_characters(parser) -> None:
text = "Thought: Let's find the temperature\nAction: search\nAction Input: what's the temperature in SF?"
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -23,7 +22,7 @@ def test_valid_action_parsing_special_characters(parser):
assert result.tool_input == "what's the temperature in SF?"
def test_valid_action_parsing_with_json_tool_input(parser):
def test_valid_action_parsing_with_json_tool_input(parser) -> None:
text = """
Thought: Let's find the information
Action: query
@@ -36,7 +35,7 @@ def test_valid_action_parsing_with_json_tool_input(parser):
assert result.tool_input == expected_tool_input
def test_valid_action_parsing_with_quotes(parser):
def test_valid_action_parsing_with_quotes(parser) -> None:
text = 'Thought: Let\'s find the temperature\nAction: search\nAction Input: "temperature in SF"'
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -44,7 +43,7 @@ def test_valid_action_parsing_with_quotes(parser):
assert result.tool_input == "temperature in SF"
def test_valid_action_parsing_with_curly_braces(parser):
def test_valid_action_parsing_with_curly_braces(parser) -> None:
text = "Thought: Let's find the temperature\nAction: search\nAction Input: {temperature in SF}"
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -52,7 +51,7 @@ def test_valid_action_parsing_with_curly_braces(parser):
assert result.tool_input == "{temperature in SF}"
def test_valid_action_parsing_with_angle_brackets(parser):
def test_valid_action_parsing_with_angle_brackets(parser) -> None:
text = "Thought: Let's find the temperature\nAction: search\nAction Input: <temperature in SF>"
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -60,7 +59,7 @@ def test_valid_action_parsing_with_angle_brackets(parser):
assert result.tool_input == "<temperature in SF>"
def test_valid_action_parsing_with_parentheses(parser):
def test_valid_action_parsing_with_parentheses(parser) -> None:
text = "Thought: Let's find the temperature\nAction: search\nAction Input: (temperature in SF)"
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -68,7 +67,7 @@ def test_valid_action_parsing_with_parentheses(parser):
assert result.tool_input == "(temperature in SF)"
def test_valid_action_parsing_with_mixed_brackets(parser):
def test_valid_action_parsing_with_mixed_brackets(parser) -> None:
text = "Thought: Let's find the temperature\nAction: search\nAction Input: [temperature in {SF}]"
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -76,7 +75,7 @@ def test_valid_action_parsing_with_mixed_brackets(parser):
assert result.tool_input == "[temperature in {SF}]"
def test_valid_action_parsing_with_nested_quotes(parser):
def test_valid_action_parsing_with_nested_quotes(parser) -> None:
text = "Thought: Let's find the temperature\nAction: search\nAction Input: \"what's the temperature in 'SF'?\""
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -84,7 +83,7 @@ def test_valid_action_parsing_with_nested_quotes(parser):
assert result.tool_input == "what's the temperature in 'SF'?"
def test_valid_action_parsing_with_incomplete_json(parser):
def test_valid_action_parsing_with_incomplete_json(parser) -> None:
text = 'Thought: Let\'s find the temperature\nAction: search\nAction Input: {"query": "temperature in SF"'
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -92,7 +91,7 @@ def test_valid_action_parsing_with_incomplete_json(parser):
assert result.tool_input == '{"query": "temperature in SF"}'
def test_valid_action_parsing_with_special_characters(parser):
def test_valid_action_parsing_with_special_characters(parser) -> None:
text = "Thought: Let's find the temperature\nAction: search\nAction Input: what is the temperature in SF? @$%^&*"
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -100,7 +99,7 @@ def test_valid_action_parsing_with_special_characters(parser):
assert result.tool_input == "what is the temperature in SF? @$%^&*"
def test_valid_action_parsing_with_combination(parser):
def test_valid_action_parsing_with_combination(parser) -> None:
text = 'Thought: Let\'s find the temperature\nAction: search\nAction Input: "[what is the temperature in SF?]"'
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -108,7 +107,7 @@ def test_valid_action_parsing_with_combination(parser):
assert result.tool_input == "[what is the temperature in SF?]"
def test_valid_action_parsing_with_mixed_quotes(parser):
def test_valid_action_parsing_with_mixed_quotes(parser) -> None:
text = "Thought: Let's find the temperature\nAction: search\nAction Input: \"what's the temperature in SF?\""
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -116,7 +115,7 @@ def test_valid_action_parsing_with_mixed_quotes(parser):
assert result.tool_input == "what's the temperature in SF?"
def test_valid_action_parsing_with_newlines(parser):
def test_valid_action_parsing_with_newlines(parser) -> None:
text = "Thought: Let's find the temperature\nAction: search\nAction Input: what is\nthe temperature in SF?"
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -124,7 +123,7 @@ def test_valid_action_parsing_with_newlines(parser):
assert result.tool_input == "what is\nthe temperature in SF?"
def test_valid_action_parsing_with_escaped_characters(parser):
def test_valid_action_parsing_with_escaped_characters(parser) -> None:
text = "Thought: Let's find the temperature\nAction: search\nAction Input: what is the temperature in SF? \\n"
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -132,7 +131,7 @@ def test_valid_action_parsing_with_escaped_characters(parser):
assert result.tool_input == "what is the temperature in SF? \\n"
def test_valid_action_parsing_with_json_string(parser):
def test_valid_action_parsing_with_json_string(parser) -> None:
text = 'Thought: Let\'s find the temperature\nAction: search\nAction Input: {"query": "temperature in SF"}'
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -140,7 +139,7 @@ def test_valid_action_parsing_with_json_string(parser):
assert result.tool_input == '{"query": "temperature in SF"}'
def test_valid_action_parsing_with_unbalanced_quotes(parser):
def test_valid_action_parsing_with_unbalanced_quotes(parser) -> None:
text = "Thought: Let's find the temperature\nAction: search\nAction Input: \"what is the temperature in SF?"
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -148,61 +147,61 @@ def test_valid_action_parsing_with_unbalanced_quotes(parser):
assert result.tool_input == "what is the temperature in SF?"
def test_clean_action_no_formatting(parser):
def test_clean_action_no_formatting(parser) -> None:
action = "Ask question to senior researcher"
cleaned_action = parser._clean_action(action)
assert cleaned_action == "Ask question to senior researcher"
def test_clean_action_with_leading_asterisks(parser):
def test_clean_action_with_leading_asterisks(parser) -> None:
action = "** Ask question to senior researcher"
cleaned_action = parser._clean_action(action)
assert cleaned_action == "Ask question to senior researcher"
def test_clean_action_with_trailing_asterisks(parser):
def test_clean_action_with_trailing_asterisks(parser) -> None:
action = "Ask question to senior researcher **"
cleaned_action = parser._clean_action(action)
assert cleaned_action == "Ask question to senior researcher"
def test_clean_action_with_leading_and_trailing_asterisks(parser):
def test_clean_action_with_leading_and_trailing_asterisks(parser) -> None:
action = "** Ask question to senior researcher **"
cleaned_action = parser._clean_action(action)
assert cleaned_action == "Ask question to senior researcher"
def test_clean_action_with_multiple_leading_asterisks(parser):
def test_clean_action_with_multiple_leading_asterisks(parser) -> None:
action = "**** Ask question to senior researcher"
cleaned_action = parser._clean_action(action)
assert cleaned_action == "Ask question to senior researcher"
def test_clean_action_with_multiple_trailing_asterisks(parser):
def test_clean_action_with_multiple_trailing_asterisks(parser) -> None:
action = "Ask question to senior researcher ****"
cleaned_action = parser._clean_action(action)
assert cleaned_action == "Ask question to senior researcher"
def test_clean_action_with_spaces_and_asterisks(parser):
def test_clean_action_with_spaces_and_asterisks(parser) -> None:
action = " ** Ask question to senior researcher ** "
cleaned_action = parser._clean_action(action)
assert cleaned_action == "Ask question to senior researcher"
def test_clean_action_with_only_asterisks(parser):
def test_clean_action_with_only_asterisks(parser) -> None:
action = "****"
cleaned_action = parser._clean_action(action)
assert cleaned_action == ""
def test_clean_action_with_empty_string(parser):
def test_clean_action_with_empty_string(parser) -> None:
action = ""
cleaned_action = parser._clean_action(action)
assert cleaned_action == ""
def test_valid_final_answer_parsing(parser):
def test_valid_final_answer_parsing(parser) -> None:
text = (
"Thought: I found the information\nFinal Answer: The temperature is 100 degrees"
)
@@ -211,36 +210,36 @@ def test_valid_final_answer_parsing(parser):
assert result.output == "The temperature is 100 degrees"
def test_missing_action_error(parser):
def test_missing_action_error(parser) -> None:
text = "Thought: Let's find the temperature\nAction Input: what is the temperature in SF?"
with pytest.raises(OutputParserException) as exc_info:
parser.parse(text)
assert "Invalid Format: I missed the 'Action:' after 'Thought:'." in str(
exc_info.value
exc_info.value,
)
def test_missing_action_input_error(parser):
def test_missing_action_input_error(parser) -> None:
text = "Thought: Let's find the temperature\nAction: search"
with pytest.raises(OutputParserException) as exc_info:
parser.parse(text)
assert "I missed the 'Action Input:' after 'Action:'." in str(exc_info.value)
def test_safe_repair_json(parser):
def test_safe_repair_json(parser) -> None:
invalid_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": Senior Researcher'
expected_repaired_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher"}'
result = parser._safe_repair_json(invalid_json)
assert result == expected_repaired_json
def test_safe_repair_json_unrepairable(parser):
def test_safe_repair_json_unrepairable(parser) -> None:
invalid_json = "{invalid_json"
result = parser._safe_repair_json(invalid_json)
assert result == invalid_json # Should return the original if unrepairable
def test_safe_repair_json_missing_quotes(parser):
def test_safe_repair_json_missing_quotes(parser) -> None:
invalid_json = (
'{task: "Research XAI", context: "Explainable AI", coworker: Senior Researcher}'
)
@@ -249,77 +248,77 @@ def test_safe_repair_json_missing_quotes(parser):
assert result == expected_repaired_json
def test_safe_repair_json_unclosed_brackets(parser):
def test_safe_repair_json_unclosed_brackets(parser) -> None:
invalid_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher"'
expected_repaired_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher"}'
result = parser._safe_repair_json(invalid_json)
assert result == expected_repaired_json
def test_safe_repair_json_extra_commas(parser):
def test_safe_repair_json_extra_commas(parser) -> None:
invalid_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher",}'
expected_repaired_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher"}'
result = parser._safe_repair_json(invalid_json)
assert result == expected_repaired_json
def test_safe_repair_json_trailing_commas(parser):
def test_safe_repair_json_trailing_commas(parser) -> None:
invalid_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher",}'
expected_repaired_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher"}'
result = parser._safe_repair_json(invalid_json)
assert result == expected_repaired_json
def test_safe_repair_json_single_quotes(parser):
def test_safe_repair_json_single_quotes(parser) -> None:
invalid_json = "{'task': 'Research XAI', 'context': 'Explainable AI', 'coworker': 'Senior Researcher'}"
expected_repaired_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher"}'
result = parser._safe_repair_json(invalid_json)
assert result == expected_repaired_json
def test_safe_repair_json_mixed_quotes(parser):
def test_safe_repair_json_mixed_quotes(parser) -> None:
invalid_json = "{'task': \"Research XAI\", 'context': \"Explainable AI\", 'coworker': 'Senior Researcher'}"
expected_repaired_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher"}'
result = parser._safe_repair_json(invalid_json)
assert result == expected_repaired_json
def test_safe_repair_json_unescaped_characters(parser):
def test_safe_repair_json_unescaped_characters(parser) -> None:
invalid_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher\n"}'
expected_repaired_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher"}'
result = parser._safe_repair_json(invalid_json)
assert result == expected_repaired_json
def test_safe_repair_json_missing_colon(parser):
def test_safe_repair_json_missing_colon(parser) -> None:
invalid_json = '{"task" "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher"}'
expected_repaired_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher"}'
result = parser._safe_repair_json(invalid_json)
assert result == expected_repaired_json
def test_safe_repair_json_missing_comma(parser):
def test_safe_repair_json_missing_comma(parser) -> None:
invalid_json = '{"task": "Research XAI" "context": "Explainable AI", "coworker": "Senior Researcher"}'
expected_repaired_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher"}'
result = parser._safe_repair_json(invalid_json)
assert result == expected_repaired_json
def test_safe_repair_json_unexpected_trailing_characters(parser):
def test_safe_repair_json_unexpected_trailing_characters(parser) -> None:
invalid_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher"} random text'
expected_repaired_json = '{"task": "Research XAI", "context": "Explainable AI", "coworker": "Senior Researcher"}'
result = parser._safe_repair_json(invalid_json)
assert result == expected_repaired_json
def test_safe_repair_json_special_characters_key(parser):
def test_safe_repair_json_special_characters_key(parser) -> None:
invalid_json = '{"task!@#": "Research XAI", "context$%^": "Explainable AI", "coworker&*()": "Senior Researcher"}'
expected_repaired_json = '{"task!@#": "Research XAI", "context$%^": "Explainable AI", "coworker&*()": "Senior Researcher"}'
result = parser._safe_repair_json(invalid_json)
assert result == expected_repaired_json
def test_parsing_with_whitespace(parser):
def test_parsing_with_whitespace(parser) -> None:
text = " Thought: Let's find the temperature \n Action: search \n Action Input: what is the temperature in SF? "
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -327,7 +326,7 @@ def test_parsing_with_whitespace(parser):
assert result.tool_input == "what is the temperature in SF?"
def test_parsing_with_special_characters(parser):
def test_parsing_with_special_characters(parser) -> None:
text = 'Thought: Let\'s find the temperature\nAction: search\nAction Input: "what is the temperature in SF?"'
result = parser.parse(text)
assert isinstance(result, AgentAction)
@@ -335,7 +334,7 @@ def test_parsing_with_special_characters(parser):
assert result.tool_input == "what is the temperature in SF?"
def test_integration_valid_and_invalid(parser):
def test_integration_valid_and_invalid(parser) -> None:
text = """
Thought: Let's find the temperature
Action: search
@@ -366,7 +365,7 @@ def test_integration_valid_and_invalid(parser):
class MockAgent:
def increment_formatting_errors(self):
def increment_formatting_errors(self) -> None:
pass