Apply Black formatting to test files
This commit is contained in:
parent
dbeede9a31
commit
f1fb1e3413
|
|
@ -35,6 +35,7 @@ def sample_config():
|
||||||
|
|
||||||
class MockResult:
|
class MockResult:
|
||||||
"""Mock result that always has proper tool_calls attribute."""
|
"""Mock result that always has proper tool_calls attribute."""
|
||||||
|
|
||||||
def __init__(self, content="Test response", tool_calls=None):
|
def __init__(self, content="Test response", tool_calls=None):
|
||||||
self.content = content
|
self.content = content
|
||||||
self.tool_calls = tool_calls if tool_calls is not None else []
|
self.tool_calls = tool_calls if tool_calls is not None else []
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,9 @@ class TestMarketAnalyst:
|
||||||
"""Test that market analyst correctly processes state variables."""
|
"""Test that market analyst correctly processes state variables."""
|
||||||
# Setup
|
# Setup
|
||||||
mock_toolkit.config = {"online_tools": False}
|
mock_toolkit.config = {"online_tools": False}
|
||||||
mock_result = MockResult(content="Analysis for AAPL on 2024-05-10", tool_calls=[])
|
mock_result = MockResult(
|
||||||
|
content="Analysis for AAPL on 2024-05-10", tool_calls=[]
|
||||||
|
)
|
||||||
|
|
||||||
# Mock the chain to capture the invoke call
|
# Mock the chain to capture the invoke call
|
||||||
mock_chain = Mock()
|
mock_chain = Mock()
|
||||||
|
|
@ -125,7 +127,9 @@ class TestMarketAnalyst:
|
||||||
"""Test handling when no tool calls are made."""
|
"""Test handling when no tool calls are made."""
|
||||||
# Setup
|
# Setup
|
||||||
mock_toolkit.config = {"online_tools": False}
|
mock_toolkit.config = {"online_tools": False}
|
||||||
mock_result = MockResult(content="No tools needed", tool_calls=[]) # Empty tool calls
|
mock_result = MockResult(
|
||||||
|
content="No tools needed", tool_calls=[]
|
||||||
|
) # Empty tool calls
|
||||||
mock_llm.bind_tools.return_value.invoke.return_value = mock_result
|
mock_llm.bind_tools.return_value.invoke.return_value = mock_result
|
||||||
|
|
||||||
analyst_node = create_market_analyst(mock_llm, mock_toolkit)
|
analyst_node = create_market_analyst(mock_llm, mock_toolkit)
|
||||||
|
|
@ -146,7 +150,9 @@ class TestMarketAnalyst:
|
||||||
"""Test handling when tool calls are present."""
|
"""Test handling when tool calls are present."""
|
||||||
# Setup
|
# Setup
|
||||||
mock_toolkit.config = {"online_tools": False}
|
mock_toolkit.config = {"online_tools": False}
|
||||||
mock_result = MockResult(content="Tool analysis", tool_calls=[Mock()]) # Non-empty tool calls
|
mock_result = MockResult(
|
||||||
|
content="Tool analysis", tool_calls=[Mock()]
|
||||||
|
) # Non-empty tool calls
|
||||||
mock_llm.bind_tools.return_value.invoke.return_value = mock_result
|
mock_llm.bind_tools.return_value.invoke.return_value = mock_result
|
||||||
|
|
||||||
analyst_node = create_market_analyst(mock_llm, mock_toolkit)
|
analyst_node = create_market_analyst(mock_llm, mock_toolkit)
|
||||||
|
|
@ -171,7 +177,7 @@ class TestMarketAnalyst:
|
||||||
mock_toolkit.config = {"online_tools": online_tools}
|
mock_toolkit.config = {"online_tools": online_tools}
|
||||||
mock_result = MockResult(
|
mock_result = MockResult(
|
||||||
content=f"Analysis in {'online' if online_tools else 'offline'} mode",
|
content=f"Analysis in {'online' if online_tools else 'offline'} mode",
|
||||||
tool_calls=[]
|
tool_calls=[],
|
||||||
)
|
)
|
||||||
mock_llm.bind_tools.return_value.invoke.return_value = mock_result
|
mock_llm.bind_tools.return_value.invoke.return_value = mock_result
|
||||||
|
|
||||||
|
|
@ -220,7 +226,7 @@ class TestMarketAnalystIntegration:
|
||||||
| MACD | +0.45 | Buy |
|
| MACD | +0.45 | Buy |
|
||||||
| Volume | High | Bullish |
|
| Volume | High | Bullish |
|
||||||
""",
|
""",
|
||||||
tool_calls=[]
|
tool_calls=[],
|
||||||
)
|
)
|
||||||
mock_llm.bind_tools.return_value.invoke.return_value = mock_result
|
mock_llm.bind_tools.return_value.invoke.return_value = mock_result
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
"""Unit tests for dataflows utils module."""
|
"""Unit tests for dataflows utils module."""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TestDataflowsUtils:
|
class TestDataflowsUtils:
|
||||||
"""Test suite for dataflows utility functions."""
|
"""Test suite for dataflows utility functions."""
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue