Skip to content

Commit

Permalink
tests: adds direct try-except coverage, w/ verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyPlanden committed Aug 19, 2024
1 parent 823cc4b commit 9b84c1e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/unit/test_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ def test_fitting_problem(self, parameters, dataset, model, signal):
# Test model.simulate with an initial state
problem.evaluate(inputs=[1e-5, 1e-5])

# Test try-except
problem.verbose = True
out = problem.evaluate(inputs=[0.0, 0.0])
assert not np.isfinite(out["Voltage [V]"])

# Test problem construction errors
for bad_dataset in [
pybop.Dataset({"Time [s]": np.array([0])}),
Expand Down Expand Up @@ -206,6 +211,7 @@ def test_fitting_problem_eis(self, parameters):
assert problem.domain == "Frequency [Hz]"

# Test try-except
problem.verbose = True
out = problem.evaluate(inputs=[0.0, 0.0])
assert not np.isfinite(out["Impedance"])

Expand Down

0 comments on commit 9b84c1e

Please sign in to comment.