File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -218,12 +218,12 @@ def wrapped_program(example_idx, example):
218218 result_df = result_df .rename (columns = {"correct" : metric_name })
219219
220220 if display_table :
221- if isinstance (display_table , int ):
222- df_to_display = result_df .head (display_table ).copy ()
223- truncated_rows = len (result_df ) - display_table
224- else :
221+ if isinstance (display_table , bool ):
225222 df_to_display = result_df .copy ()
226223 truncated_rows = 0
224+ else :
225+ df_to_display = result_df .head (display_table ).copy ()
226+ truncated_rows = len (result_df ) - display_table
227227
228228 styled_df = configure_dataframe_display (df_to_display , metric_name )
229229
Original file line number Diff line number Diff line change @@ -112,11 +112,17 @@ def test_evaluate_call_bad():
112112 assert score == 0.0
113113
114114
115- def test_evaluate_display_table ():
115+ @pytest .mark .parametrize (
116+ "display_table" , [True , False , 1 ]
117+ )
118+ def test_evaluate_display_table (display_table ):
116119 devset = [new_example ("What is 1+1?" , "2" )]
120+ program = Predict ("question -> answer" )
117121 ev = Evaluate (
118122 devset = devset ,
119123 metric = answer_exact_match ,
120- display_table = True ,
124+ display_table = display_table ,
121125 )
122- assert ev .display_table == True
126+ assert ev .display_table == display_table
127+
128+ ev (program )
You can’t perform that action at this time.
0 commit comments