fix: Apply Black formatting to test_market_analyst.py

- Changed single quotes to double quotes in @patch decorators
- Ensures Code Quality checks pass

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
佐藤優一 2025-08-11 12:21:50 +09:00
parent a6e7f383e8
commit 55f0b18693
1 changed files with 22 additions and 18 deletions

View File

@ -17,7 +17,7 @@ class TestMarketAnalyst:
analyst_node = create_market_analyst(mock_llm, mock_toolkit) analyst_node = create_market_analyst(mock_llm, mock_toolkit)
assert callable(analyst_node) assert callable(analyst_node)
@patch('tradingagents.agents.analysts.market_analyst.ChatPromptTemplate') @patch("tradingagents.agents.analysts.market_analyst.ChatPromptTemplate")
def test_market_analyst_node_basic_execution( def test_market_analyst_node_basic_execution(
self, self,
mock_prompt_template, mock_prompt_template,
@ -48,7 +48,7 @@ class TestMarketAnalyst:
assert result["messages"] == [mock_result] assert result["messages"] == [mock_result]
assert result["market_report"] == "Market analysis complete" assert result["market_report"] == "Market analysis complete"
@patch('tradingagents.agents.analysts.market_analyst.ChatPromptTemplate') @patch("tradingagents.agents.analysts.market_analyst.ChatPromptTemplate")
def test_market_analyst_uses_online_tools_when_configured( def test_market_analyst_uses_online_tools_when_configured(
self, self,
mock_prompt_template, mock_prompt_template,
@ -78,7 +78,7 @@ class TestMarketAnalyst:
# Verify - just check that the function completes without error # Verify - just check that the function completes without error
# bind_tools is a function mock, not a Mock object, so we can't assert calls # bind_tools is a function mock, not a Mock object, so we can't assert calls
@patch('tradingagents.agents.analysts.market_analyst.ChatPromptTemplate') @patch("tradingagents.agents.analysts.market_analyst.ChatPromptTemplate")
def test_market_analyst_uses_offline_tools_when_configured( def test_market_analyst_uses_offline_tools_when_configured(
self, self,
mock_prompt_template, mock_prompt_template,
@ -108,7 +108,7 @@ class TestMarketAnalyst:
# Verify - just check that the function completes without error # Verify - just check that the function completes without error
# bind_tools is a function mock, not a Mock object, so we can't assert calls # bind_tools is a function mock, not a Mock object, so we can't assert calls
@patch('tradingagents.agents.analysts.market_analyst.ChatPromptTemplate') @patch("tradingagents.agents.analysts.market_analyst.ChatPromptTemplate")
def test_market_analyst_processes_state_variables( def test_market_analyst_processes_state_variables(
self, self,
mock_prompt_template, mock_prompt_template,
@ -138,10 +138,12 @@ class TestMarketAnalyst:
result = analyst_node(sample_agent_state) result = analyst_node(sample_agent_state)
# Verify that invoke was called with the state # Verify that invoke was called with the state
mock_llm._chain_mock.invoke.assert_called_once_with(sample_agent_state["messages"]) mock_llm._chain_mock.invoke.assert_called_once_with(
sample_agent_state["messages"]
)
assert result["market_report"] == "Analysis for AAPL on 2024-05-10" assert result["market_report"] == "Analysis for AAPL on 2024-05-10"
@patch('tradingagents.agents.analysts.market_analyst.ChatPromptTemplate') @patch("tradingagents.agents.analysts.market_analyst.ChatPromptTemplate")
def test_market_analyst_handles_empty_tool_calls( def test_market_analyst_handles_empty_tool_calls(
self, self,
mock_prompt_template, mock_prompt_template,
@ -172,7 +174,7 @@ class TestMarketAnalyst:
assert result["market_report"] == "No tools needed" assert result["market_report"] == "No tools needed"
assert result["messages"] == [mock_result] assert result["messages"] == [mock_result]
@patch('tradingagents.agents.analysts.market_analyst.ChatPromptTemplate') @patch("tradingagents.agents.analysts.market_analyst.ChatPromptTemplate")
def test_market_analyst_with_tool_calls( def test_market_analyst_with_tool_calls(
self, self,
mock_prompt_template, mock_prompt_template,
@ -204,7 +206,7 @@ class TestMarketAnalyst:
assert result["messages"] == [mock_result] assert result["messages"] == [mock_result]
@pytest.mark.parametrize("online_tools", [True, False]) @pytest.mark.parametrize("online_tools", [True, False])
@patch('tradingagents.agents.analysts.market_analyst.ChatPromptTemplate') @patch("tradingagents.agents.analysts.market_analyst.ChatPromptTemplate")
def test_market_analyst_tool_configuration( def test_market_analyst_tool_configuration(
self, self,
mock_prompt_template, mock_prompt_template,
@ -242,8 +244,10 @@ class TestMarketAnalyst:
class TestMarketAnalystIntegration: class TestMarketAnalystIntegration:
"""Integration-style tests for market analyst.""" """Integration-style tests for market analyst."""
@patch('tradingagents.agents.analysts.market_analyst.ChatPromptTemplate') @patch("tradingagents.agents.analysts.market_analyst.ChatPromptTemplate")
def test_market_analyst_full_workflow(self, mock_prompt_template, mock_llm, mock_toolkit): def test_market_analyst_full_workflow(
self, mock_prompt_template, mock_llm, mock_toolkit
):
"""Test a complete workflow simulation.""" """Test a complete workflow simulation."""
# Setup mock for ChatPromptTemplate # Setup mock for ChatPromptTemplate
mock_prompt = Mock() mock_prompt = Mock()