@@ -149,10 +149,8 @@ def test_create_pre_optimization_summary_handles_missing_attributes(self):
149149 assert summary .guidance is None
150150 assert summary .baseline_score is None
151151
152- def test_create_and_display_summary (self , caplog ):
152+ def test_create_and_display_summary (self ):
153153 """Test the convenience function that creates and displays summary."""
154- import logging
155-
156154 mock_strategy = MagicMock ()
157155 mock_strategy .proposer_kwargs = None
158156 mock_strategy .compute_baseline = False
@@ -178,31 +176,24 @@ def test_create_and_display_summary(self, caplog):
178176
179177 prompt_data = {"text" : "test prompt" }
180178
181- with caplog .at_level (logging .INFO ):
182- summary = create_and_display_summary (mock_strategy , prompt_data )
179+ summary = create_and_display_summary (mock_strategy , prompt_data )
183180
184181 # Should return a summary
185182 assert isinstance (summary , PreOptimizationSummary )
183+ assert summary .task_model == "mock_task_model"
184+ assert summary .proposer_model == "mock_prompt_model"
185+ assert summary .metric_name == "test_metric"
186186
187- # Should have logged the summary (check for the header)
188- assert "=== Pre-Optimization Summary ===" in caplog .text
189-
190- def test_create_and_display_summary_handles_errors (self , caplog ):
187+ def test_create_and_display_summary_handles_errors (self ):
191188 """Test that create_and_display_summary handles errors gracefully."""
192- import logging
193-
194189 # Create a strategy that will cause an error
195190 mock_strategy = MagicMock ()
196191 mock_strategy ._get_model_name .side_effect = Exception ("Test error" )
197192
198193 prompt_data = {"text" : "test prompt" }
199194
200- with caplog .at_level (logging .WARNING ):
201- summary = create_and_display_summary (mock_strategy , prompt_data )
195+ summary = create_and_display_summary (mock_strategy , prompt_data )
202196
203197 # Should return a minimal summary instead of failing
204198 assert isinstance (summary , PreOptimizationSummary )
205199 assert summary .task_model == "Unknown"
206-
207- # Should have logged the error
208- assert "Failed to create or display pre-optimization summary" in caplog .text
0 commit comments