Fix Black formatting issues in mock toolkit files

This commit is contained in:
佐藤優一 2025-08-11 10:47:55 +09:00
parent 0ab8c8fc46
commit 12370845eb
2 changed files with 30 additions and 27 deletions

View File

@ -27,7 +27,7 @@ def test_mock_toolkit_has_all_methods():
for method_name in required_methods: for method_name in required_methods:
assert hasattr(toolkit, method_name), f"Missing {method_name}" assert hasattr(toolkit, method_name), f"Missing {method_name}"
method = getattr(toolkit, method_name) method = getattr(toolkit, method_name)
assert hasattr(method, '__name__'), f"{method_name} missing __name__" assert hasattr(method, "__name__"), f"{method_name} missing __name__"
assert method.__name__ == method_name, f"{method_name} has wrong __name__" assert method.__name__ == method_name, f"{method_name} has wrong __name__"
assert callable(method), f"{method_name} is not callable" assert callable(method), f"{method_name} is not callable"
@ -46,10 +46,12 @@ def test_tool_node_creation():
# Simulate creating tool nodes like in TradingAgentsGraph # Simulate creating tool nodes like in TradingAgentsGraph
from langgraph.prebuilt import ToolNode from langgraph.prebuilt import ToolNode
tool_node = ToolNode([ tool_node = ToolNode(
toolkit.get_YFin_data, [
toolkit.get_stockstats_indicators_report, toolkit.get_YFin_data,
]) toolkit.get_stockstats_indicators_report,
]
)
# Should not raise an error # Should not raise an error
assert MockToolNode.called assert MockToolNode.called
@ -63,9 +65,9 @@ def test_tool_decorator():
# The @tool decorator expects __name__ attribute # The @tool decorator expects __name__ attribute
for attr_name in dir(toolkit): for attr_name in dir(toolkit):
if attr_name.startswith('get_'): if attr_name.startswith("get_"):
method = getattr(toolkit, attr_name) method = getattr(toolkit, attr_name)
assert hasattr(method, '__name__'), f"{attr_name} missing __name__" assert hasattr(method, "__name__"), f"{attr_name} missing __name__"
print("✓ All toolkit methods are compatible with @tool decorator") print("✓ All toolkit methods are compatible with @tool decorator")
return True return True
@ -91,6 +93,7 @@ if __name__ == "__main__":
all_passed = False all_passed = False
print(f"{test.__name__} raised exception: {e}") print(f"{test.__name__} raised exception: {e}")
import traceback import traceback
traceback.print_exc() traceback.print_exc()
print("-" * 50) print("-" * 50)