From 5fee363086f47c3680b44b29924bf1f301a2d6d6 Mon Sep 17 00:00:00 2001 From: User Date: Wed, 22 May 2024 15:47:58 +0300 Subject: [PATCH] add test tool chain --- tests/test_tools/test_tool_chain.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/test_tools/test_tool_chain.py diff --git a/tests/test_tools/test_tool_chain.py b/tests/test_tools/test_tool_chain.py new file mode 100644 index 00000000..408e87de --- /dev/null +++ b/tests/test_tools/test_tool_chain.py @@ -0,0 +1,23 @@ +import pytest + +from motleycrew.tools import MotleyTool + + +class ToolMock: + def invoke(self, input_dict: dict, *args, **kwargs): + return input_dict + + +@pytest.fixture +def tools(): + tool1 = MotleyTool(ToolMock()) + tool2 = MotleyTool(ToolMock()) + return [tool1, tool2] + + +def test_tool_chain(tools): + tool1, tool2 = tools + tool_chain = tool1 | tool2 + assert hasattr(tool_chain, "invoke") + prompt = {"prompt": "test prompt"} + assert tool_chain.invoke(prompt) == prompt