Skip to content

Commit

Permalink
fix docs and coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer committed Dec 8, 2023
1 parent 2415a72 commit a109848
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
13 changes: 13 additions & 0 deletions tests/unit/test_experiments/test_experiment_step_termination.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Test the experiment steps
#
import pybamm
import unittest


class TestExperimentStepTermination(unittest.TestCase):
def test_base_termination(self):
term = pybamm.step.BaseTermination(1)
self.assertEqual(term.value, 1)
self.assertNotEqual(term, pybamm.step.BaseTermination(2))
self.assertNotEqual(term, pybamm.step.CurrentTermination(1))
14 changes: 12 additions & 2 deletions tests/unit/test_plotting/test_quick_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,9 @@ def test_spm_simulation(self):
with TemporaryDirectory() as dir_name:
test_stub = os.path.join(dir_name, "spm_sim_test")
test_file = f"{test_stub}.gif"
quick_plot.create_gif(number_of_images=3, duration=3,
output_filename=test_file)
quick_plot.create_gif(
number_of_images=3, duration=3, output_filename=test_file
)
assert not os.path.exists(f"{test_stub}*.png")
assert os.path.exists(test_file)
pybamm.close_plots()
Expand Down Expand Up @@ -508,6 +509,15 @@ def test_model_with_inputs(self):
pybamm.close_plots()


class TestQuickPlotAxes(unittest.TestCase):
def test_quick_plot_axes(self):
axes = pybamm.QuickPlotAxes()
axes.add(("test 1", "test 2"), 1)
self.assertEqual(axes[0], 1)
self.assertEqual(axes.by_variable("test 1"), 1)
self.assertEqual(axes.by_variable("test 2"), 1)


if __name__ == "__main__":
print("Add -v for more debug output")
import sys
Expand Down

0 comments on commit a109848

Please sign in to comment.