Simulate json or beb model from the command line
This commit is contained in:
29
tests/unit/test_simulation_util.py
Normal file
29
tests/unit/test_simulation_util.py
Normal file
@@ -0,0 +1,29 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user