tool functions and pytest
This commit is contained in:
30
tests/test_tool_function_decorator.py
Normal file
30
tests/test_tool_function_decorator.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import pytest
|
||||
import tool_helper
|
||||
import tests.helper as helper
|
||||
|
||||
|
||||
def test_tool_function_decorator_if_clean_tool_list():
|
||||
""" tests for the tool list to be empty. NOT strictly nessesary,
|
||||
but I want to be warned if this is not the case anymore. Could be not the intention """
|
||||
start_len = len(tool_helper.tool_list)
|
||||
assert start_len == 0
|
||||
|
||||
def test_tool_function_decorator():
|
||||
# get length before adding tools
|
||||
start_len = len(tool_helper.tool_list)
|
||||
|
||||
# add tools like it would be a decorator
|
||||
tool_helper.tool(helper.tool_dummy)
|
||||
tool_helper.tool(helper.tool_dummy2)
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user