mostly working shape?

This commit is contained in:
Aron Petau 2025-12-31 16:06:42 +01:00
parent 3057cda8d3
commit 540a3cc884
10 changed files with 462 additions and 183 deletions

View file

@ -24,17 +24,23 @@ class DummyStateManager:
def is_autopilot_enabled(self): return False
@patch("matplotlib.pyplot.savefig")
def test_generate_error_rate_plot_no_data(mock_savefig, temp_applications_file):
handler = ApplicationHandler(None, DummyStateManager(), applications_file=temp_applications_file)
class DummyContext: pass
handler = ApplicationHandler(DummyContext(), DummyStateManager(), applications_file=temp_applications_file)
plot_path, summary = handler._generate_error_rate_plot()
assert plot_path is None or plot_path == ""
assert summary == ""
@patch("matplotlib.pyplot.savefig")
from unittest.mock import patch
@patch("matplotlib.figure.Figure.savefig")
def test_generate_error_rate_plot_with_data(mock_savefig, temp_applications_file):
handler = ApplicationHandler(None, DummyStateManager(), applications_file=temp_applications_file)
class DummyContext: pass
handler = ApplicationHandler(DummyContext(), DummyStateManager(), applications_file=temp_applications_file)
# Write valid data to the temp applications file
temp_applications_file.write_text('''
{
@ -48,4 +54,4 @@ def test_generate_error_rate_plot_with_data(mock_savefig, temp_applications_file
assert "Successes" in summary
assert "Failures" in summary
assert "Overall error rate" in summary
mock_savefig.assert_called_once()
mock_savefig.assert_called()