Skip to content

Commit

Permalink
Tentative test fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Biscani authored and Francesco Biscani committed Sep 2, 2023
1 parent 2e224a8 commit c9c67cd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions heyoka/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _get_eps(fp_t):


def _isclose(a, b, rtol, atol):
from numpy import errstate, less_equal, asanyarray, isfinite, zeros_like, ones_like
from numpy import all, errstate, less_equal, asanyarray, isfinite, zeros_like, ones_like

def within_tol(x, y, atol, rtol):
with errstate(invalid="ignore"):
Expand Down Expand Up @@ -57,6 +57,7 @@ def within_tol(x, y, atol, rtol):


def _allclose(a, b, rtol, atol):
from numpy import all
res = all(_isclose(a, b, rtol=rtol, atol=atol))
return bool(res)

Expand Down Expand Up @@ -115,7 +116,14 @@ def test_basic(self):
ta.step(write_tc=True)
jet(st)

self.assertTrue(np.all(ta.tc[:, :6].transpose() == st))
self.assertTrue(
_allclose(
ta.tc[:, :6].transpose(),
st,
rtol=_get_eps(fp_t) * 10,
atol=_get_eps(fp_t) * 10,
)
)

# Try adding an sv_func.
jet = taylor_add_jet(sys, 5, fp_type=fp_t, sv_funcs=[x + v])
Expand Down

0 comments on commit c9c67cd

Please sign in to comment.