@@ -52,6 +52,7 @@ def test_init(self):
52
52
"multiply" ,
53
53
"divide" ,
54
54
"slow" ,
55
+ "speak" ,
55
56
},
56
57
"Initializing tool library with functions failed." ,
57
58
)
@@ -71,6 +72,7 @@ def test_init_verbose_id(self):
71
72
"tests__example_tools__multiply" ,
72
73
"tests__example_tools__divide" ,
73
74
"tests__example_tools__slow" ,
75
+ "tests__example_tools__speak" ,
74
76
},
75
77
"Initializing tool library with functions failed." ,
76
78
)
@@ -128,7 +130,7 @@ def test_init_file_unspecified(self):
128
130
functions = tulip .collection .get (include = [])["ids" ]
129
131
self .assertEqual (
130
132
len (functions ),
131
- 5 ,
133
+ 6 ,
132
134
"Functions from file were not added in first initialization." ,
133
135
)
134
136
tulip = ToolLibrary (chroma_sub_dir = "test/" )
@@ -232,6 +234,7 @@ def test_load_file(self):
232
234
"multiply" ,
233
235
"divide" ,
234
236
"slow" ,
237
+ "speak" ,
235
238
},
236
239
"Loading entire file failed." ,
237
240
)
@@ -294,6 +297,7 @@ def test_remove_tool(self):
294
297
"multiply" ,
295
298
"divide" ,
296
299
"slow" ,
300
+ "speak" ,
297
301
},
298
302
"Removing function failed." ,
299
303
)
@@ -313,9 +317,7 @@ def test_execute(self):
313
317
tulip = ToolLibrary (
314
318
chroma_sub_dir = "test/" , file_imports = [("tests.example_tools" , ["multiply" ])]
315
319
)
316
- res , error = tulip .execute (
317
- tool_id = "multiply" , arguments = {"a" : 2.0 , "b" : 2.0 }
318
- )
320
+ res , error = tulip .execute (tool_id = "multiply" , arguments = {"a" : 2.0 , "b" : 2.0 })
319
321
self .assertEqual (error , False , "Function execution failed." )
320
322
self .assertEqual (
321
323
res ,
@@ -329,9 +331,7 @@ def test_execute_timeout(self):
329
331
file_imports = [("tests.example_tools" , ["slow" ])],
330
332
default_timeout = 1 ,
331
333
)
332
- res , error = tulip .execute (
333
- tool_id = "slow" , arguments = {"duration" : 2 }
334
- )
334
+ res , error = tulip .execute (tool_id = "slow" , arguments = {"duration" : 2 })
335
335
self .assertEqual (error , True , "Function execution succeeded despite timeout." )
336
336
self .assertEqual (
337
337
res ,
@@ -343,9 +343,7 @@ def test_execute_unknown_tool(self):
343
343
tulip = ToolLibrary (
344
344
chroma_sub_dir = "test/" , file_imports = [("tests.example_tools" , [])]
345
345
)
346
- res , error = tulip .execute (
347
- tool_id = "unknown" , arguments = {}
348
- )
346
+ res , error = tulip .execute (tool_id = "unknown" , arguments = {})
349
347
self .assertEqual (error , True , "Calling unknown function not caught." )
350
348
self .assertEqual (
351
349
res ,
@@ -357,9 +355,7 @@ def test_execute_invalid_arguments(self):
357
355
tulip = ToolLibrary (
358
356
chroma_sub_dir = "test/" , file_imports = [("tests.example_tools" , ["multiply" ])]
359
357
)
360
- res , error = tulip .execute (
361
- tool_id = "multiply" , arguments = {"a" : 1 , "wrong" : 2 }
362
- )
358
+ res , error = tulip .execute (tool_id = "multiply" , arguments = {"a" : 1 , "wrong" : 2 })
363
359
self .assertEqual (
364
360
error , True , "Function execution succeeded despite wrong arguments."
365
361
)
0 commit comments