Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing scheduled test on MSMR #348

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

## Bug Fixes

- [#347](https://github.com/pybop-team/PyBOP/issues/347) - Resets options between MSMR tests to cope with a bug in PyBaMM v23.9 which is fixed in PyBaMM v24.1.
- [#337](https://github.com/pybop-team/PyBOP/issues/337) - Restores benchmarks, relaxes CI schedule for benchmarks and scheduled tests.
- [#231](https://github.com/pybop-team/PyBOP/issues/231) - Allows passing of keyword arguments to PyBaMM models and disables build on initialisation.
- [#321](https://github.com/pybop-team/PyBOP/pull/321) - Improves `integration/test_spm_parameterisation.py` stability, adds flakly pytest plugin, and `test_thevenin_parameterisation.py` integration test.
Expand Down
29 changes: 16 additions & 13 deletions tests/unit/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,31 @@ class TestModels:
"""

@pytest.mark.parametrize(
"model_class, expected_name",
"model_class, expected_name, options",
[
(pybop.lithium_ion.SPM, "Single Particle Model"),
(pybop.lithium_ion.SPMe, "Single Particle Model with Electrolyte"),
(pybop.lithium_ion.DFN, "Doyle-Fuller-Newman"),
(pybop.lithium_ion.MPM, "Many Particle Model"),
(pybop.lithium_ion.MSMR, "Multi Species Multi Reactions Model"),
(pybop.lithium_ion.WeppnerHuggins, "Weppner & Huggins model"),
(pybop.empirical.Thevenin, "Equivalent Circuit Thevenin Model"),
(pybop.lithium_ion.SPM, "Single Particle Model", None),
(pybop.lithium_ion.SPMe, "Single Particle Model with Electrolyte", None),
(pybop.lithium_ion.DFN, "Doyle-Fuller-Newman", None),
(pybop.lithium_ion.MPM, "Many Particle Model", None),
(
pybop.lithium_ion.MSMR,
"Multi Species Multi Reactions Model",
{"number of MSMR reactions": ("6", "4")},
),
(pybop.lithium_ion.WeppnerHuggins, "Weppner & Huggins model", None),
(pybop.empirical.Thevenin, "Equivalent Circuit Thevenin Model", None),
],
)
@pytest.mark.unit
def test_model_classes(self, model_class, expected_name):
options = None
if model_class is pybop.lithium_ion.MSMR:
options = {"number of MSMR reactions": ("6", "4")}
def test_model_classes(self, model_class, expected_name, options):
model = model_class(options=options)

assert model.pybamm_model is not None
assert model.name == expected_name

# Test initialisation with kwargs
if model_class is pybop.lithium_ion.MSMR:
# Reset the options to cope with a bug in PyBaMM v23.9 msmr.py:23 which is fixed in v24.1
options = {"number of MSMR reactions": ("6", "4")}
parameter_set = pybop.ParameterSet(
params_dict={"Nominal cell capacity [A.h]": 5}
)
Expand Down
Loading