Skip to content

Commit

Permalink
Add test for case if dependency is available
Browse files Browse the repository at this point in the history
  • Loading branch information
arjxn-py committed Nov 9, 2023
1 parent 7cb2ef6 commit b681bbc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/unit/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,9 @@ def test_have_optional_dependency(self):
model.initial_conditions = {v: 1}
sim = pybamm.Simulation(model)
sim.solve([0, 1])
with self.assertRaisesRegex(ModuleNotFoundError,"Optional dependency autograd is not available. See https://docs.pybamm.org/en/latest/source/user_guide/installation/index.html#optional-dependencies for more details."):
sys.modules['autograd'] = None
a = pybamm.StateVector(slice(0, 1))
pybamm.Function(test_function, a)

sys.modules['pybtex'] = pybamm.util.have_optional_dependency("pybtex")
pybamm.print_citations()


class TestSearch(TestCase):
Expand Down

0 comments on commit b681bbc

Please sign in to comment.