From 9ba4cab6c64573e496268a5f8f0aa75382b83183 Mon Sep 17 00:00:00 2001 From: Akihiko Kuroda Date: Fri, 19 Jun 2026 19:14:55 -0400 Subject: [PATCH 1/2] improve repair instruction Signed-off-by: Akihiko Kuroda --- mellea/stdlib/sampling/feedback.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mellea/stdlib/sampling/feedback.py b/mellea/stdlib/sampling/feedback.py index e5ec03062..ef9604752 100644 --- a/mellea/stdlib/sampling/feedback.py +++ b/mellea/stdlib/sampling/feedback.py @@ -265,7 +265,8 @@ def format_matplotlib_error(validation_result: ValidationResult) -> str: ) return ( f"Your code didn't save the plot to the expected file. " - f"Try: Add plt.savefig('{expected_path}') before plt.show() or plt.close()." + f"Try: Add plt.savefig('{expected_path}') before plt.show() or plt.close(). " + f"Do not use a variable as an argument of plt.savefig. Use a string literal as the argument like plt.savefig('{expected_path}'). " ) else: return ( From 1e51a883a7fda0a30ff5736d785e4b3993418d47 Mon Sep 17 00:00:00 2001 From: Akihiko Kuroda Date: Mon, 22 Jun 2026 10:09:27 -0400 Subject: [PATCH 2/2] review comment Signed-off-by: Akihiko Kuroda --- test/stdlib/sampling/test_presets.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/stdlib/sampling/test_presets.py b/test/stdlib/sampling/test_presets.py index bf303faf8..b5039eda5 100644 --- a/test/stdlib/sampling/test_presets.py +++ b/test/stdlib/sampling/test_presets.py @@ -282,6 +282,7 @@ def test_matplotlib_plot_file_saved_error_formatting(self): assert "plot.png" in formatted assert "plt.savefig('plot.png')" in formatted assert "Try:" in formatted + assert "Do not use a variable as an argument" in formatted def test_matplotlib_plot_file_saved_error_with_custom_path(self): """Test PlotFileSaved error formatting with custom output path.""" @@ -290,6 +291,7 @@ def test_matplotlib_plot_file_saved_error_with_custom_path(self): formatted = ModelFriendlyFeedbackFormatter.format_matplotlib_error(result) assert "/tmp/output.png" in formatted assert "plt.savefig('/tmp/output.png')" in formatted + assert "Do not use a variable as an argument" in formatted def test_matplotlib_plot_file_saved_error_fallback(self): """Test PlotFileSaved error formatting with malformed reason (fallback)."""