|
1 | 1 | """ |
2 | 2 | Purpose: Logic checks for helper tools. |
3 | 3 |
|
4 | | -What it does: Verifies that the LivePlotter correctly appends data to arrays and that formatting utilities define the correct fonts/styles. |
| 4 | +What it does: Verifies that formatting utilities define the correct fonts/styles. |
5 | 5 | """ |
6 | 6 | import pytest |
7 | 7 | from unittest.mock import MagicMock, patch |
|
13 | 13 | if project_root not in sys.path: |
14 | 14 | sys.path.insert(0, project_root) |
15 | 15 |
|
16 | | -def test_live_plotter_logic(): |
17 | | - """ |
18 | | - Tests the LivePlotter class. We mock matplotlib, but we verify |
19 | | - that the class handles data appending correctly. |
20 | | - """ |
21 | | - # Mock matplotlib so we don't need a screen |
22 | | - with patch('matplotlib.pyplot.figure'), \ |
23 | | - patch('matplotlib.backends.backend_tkagg.FigureCanvasTkAgg'): |
24 | | - |
25 | | - try: |
26 | | - from pica.utils.LivePlotter import LivePlotter |
27 | | - except ImportError: |
28 | | - pytest.skip("Could not import LivePlotter.") |
29 | | - |
30 | | - # Instantiate |
31 | | - mock_root = MagicMock() |
32 | | - plotter = LivePlotter(mock_root) |
33 | | - |
34 | | - # Test 1: Check initial state |
35 | | - assert hasattr(plotter, 'x_data') |
36 | | - assert hasattr(plotter, 'y_data') |
37 | | - assert len(plotter.x_data) == 0 |
38 | | - |
39 | | - # Test 2: Update Logic (The most important part) |
40 | | - # We simulate adding a data point |
41 | | - plotter.update_plot(1.0, 10.5) |
42 | | - |
43 | | - # Verify data was stored (This proves the logic works) |
44 | | - assert len(plotter.x_data) == 1 |
45 | | - assert len(plotter.y_data) == 1 |
46 | | - assert plotter.x_data[0] == 1.0 |
47 | | - assert plotter.y_data[0] == 10.5 |
48 | | - print("\n[Utilities] LivePlotter data appending logic verified.") |
49 | | - |
50 | 16 | def test_gui_basic_formatter(): |
51 | 17 | """ |
52 | 18 | Tests the GUI_Basic_Format module. |
|
0 commit comments