30 lines
711 B
Python
30 lines
711 B
Python
from __future__ import annotations
|
|
|
|
import matplotlib
|
|
import pytest
|
|
|
|
from bedit_simulation import SimulationResult
|
|
from bedit_util.simulate import create_results_figure
|
|
|
|
matplotlib.use("Agg")
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_creates_result_figure_with_trace_controls() -> None:
|
|
import matplotlib.pyplot as plt
|
|
|
|
result = SimulationResult(
|
|
model_name="Example",
|
|
data={
|
|
"time": [0.0, 1.0],
|
|
"x": [1.0, 2.0],
|
|
"y": [3.0, 4.0],
|
|
},
|
|
)
|
|
|
|
figure = create_results_figure(result)
|
|
|
|
assert {line.get_label() for line in figure.axes[0].lines} == {"x", "y"}
|
|
assert len(figure._bedit_widgets) == 3 # type: ignore[attr-defined]
|
|
plt.close(figure)
|