@@ -119,34 +119,34 @@ def test_add_tools_from_context_actions():
119119 assert tools ["tool2" ] == ftc1 .tool2 , f"{ tools ["tool2" ]} should == { ftc1 .tool2 } "
120120
121121
122- # def test_tool_called(m: MelleaSession, table: Table):
123- # """We don't force tools to be called. As a result, this test might unexpectedly fail."""
124- # r = 10
125-
126- # returned_tool = False
127- # for i in range(r):
128- # transformed = m.transform(table, "add a new row to this table")
129- # if isinstance(transformed, Table):
130- # returned_tool = True
131- # break
132-
133- # assert returned_tool, f"did not return a tool after {r} attempts"
134-
135-
136- # def test_tool_not_called(m: MelleaSession, table: Table):
137- # """Ensure tools aren't always called when provided."""
138- # r = 10
139-
140- # returned_no_tool = False
141- # for i in range(r):
142- # transformed = m.transform(table, "output a text description of this table")
143- # if isinstance(transformed, ModelOutputThunk):
144- # returned_no_tool = True
145- # break
146-
147- # assert (
148- # returned_no_tool
149- # ), f"only returned tools after {r} attempts, should've returned a response with no tools"
122+ def test_tool_called (m : MelleaSession , table : Table ):
123+ """We don't force tools to be called. As a result, this test might unexpectedly fail."""
124+ r = 10
125+
126+ returned_tool = False
127+ for i in range (r ):
128+ transformed = m .transform (table , "add a new row to this table" )
129+ if isinstance (transformed , Table ):
130+ returned_tool = True
131+ break
132+
133+ assert returned_tool , f"did not return a tool after { r } attempts"
134+
135+
136+ def test_tool_not_called (m : MelleaSession , table : Table ):
137+ """Ensure tools aren't always called when provided."""
138+ r = 10
139+
140+ returned_no_tool = False
141+ for i in range (r ):
142+ transformed = m .transform (table , "output a text description of this table" )
143+ if isinstance (transformed , ModelOutputThunk ):
144+ returned_no_tool = True
145+ break
146+
147+ assert (
148+ returned_no_tool
149+ ), f"only returned tools after { r } attempts, should've returned a response with no tools"
150150
151151if __name__ == "__main__" :
152152 pytest .main ([__file__ ])
0 commit comments