Skip to content

Commit 1aaf1c9

Browse files
authored
add tool test (#3)
1 parent 1da0ef7 commit 1aaf1c9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_agent.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from unittest.mock import MagicMock
2+
13
from llm_agents_from_scratch.base.llm import BaseLLM
24
from llm_agents_from_scratch.core import LLMAgent
35

@@ -9,3 +11,17 @@ def test_init(mock_llm: BaseLLM) -> None:
911

1012
assert len(agent.tools) == 0
1113
assert agent.llm == mock_llm
14+
15+
16+
def test_add_tool(mock_llm: BaseLLM) -> None:
17+
"""tests add tool"""
18+
19+
# arrange
20+
tool = MagicMock()
21+
agent = LLMAgent(llm=mock_llm)
22+
23+
# act
24+
agent.add_tool(tool)
25+
26+
# assert
27+
assert agent.tools == [tool]

0 commit comments

Comments
 (0)