You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

29 lines
846 B

import pytest
import chatbug.tool_helper as tool_helper
from tests import helper
def test_tool_function_decorator():
""" @tool """
# get length before adding tools
start_len = len(tool_helper.tool_list)
# add tools like it would be a decorator
res = tool_helper.tool(helper.tool_dummy)
assert res == helper.tool_dummy # decorator should return the function itself, so it is usable just in case.
res = tool_helper.tool(helper.tool_dummy2)
assert res == helper.tool_dummy2 # decorator should return the function itself, so it is usable just in case.
# get length after adding tools
end_len = len(tool_helper.tool_list)
# remove the added ones again
tool_helper.tool_list = tool_helper.tool_list[:-2]
assert end_len == start_len + 2
assert len(tool_helper.tool_list) == start_len