Skip to content

Commit

Permalink
Added tests for interpolators
Browse files Browse the repository at this point in the history
  • Loading branch information
hgrecco committed Jan 4, 2021
1 parent 78e211b commit 0b35241
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions nbkode/testsuite/test_against_scipy.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,14 @@ def test_exponential2(nbkode_cls, scipy_cls):
assert_allclose(nbkode_sol.f, scipy_sol.f, err_msg=msg)
assert_allclose(nbkode_sol.h, scipy_sol.h_abs, err_msg=msg)
assert_allclose(nbkode_sol.K, scipy_sol.K, err_msg=msg)


@pytest.mark.parametrize("nbkode_cls, scipy_cls", equivalents)
def test_interpolate(nbkode_cls, scipy_cls):
t_eval = np.linspace(0, 300, 160)
nb_t, nb_y = nbkode_cls(exponential2, 0, y0_2, t_bound=500).run(t_eval)
scipy_sol = integrate.solve_ivp(
exponential2, [0, 500], y0_2, t_eval=t_eval, method=scipy_cls.__name__
)
assert_allclose(nb_t, scipy_sol.t)
assert_allclose(nb_y, scipy_sol.y.T)

0 comments on commit 0b35241

Please sign in to comment.