Skip to content

Commit

Permalink
Replaced commented-out tests with appropriate pytest.mark.skip
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterMeisrimelModelon committed Feb 12, 2024
1 parent 850beee commit 4a349ff
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
9 changes: 4 additions & 5 deletions tests/solvers/test_odepack.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import pytest
from assimulo.lib.odepack import dsrcar, dcfode
from assimulo.solvers.odepack import RKStarterNordsieck
from assimulo.solvers import LSODAR
from assimulo.problem import Explicit_Problem
from assimulo.exception import TimeLimitExceeded
Expand Down Expand Up @@ -232,13 +233,12 @@ def test_writereadcommon(self):
assert r[0] == pytest.approx(1., abs = 1e-4)
assert i[0] == 1

@pytest.mark.skip("Test broken")
def test_rkstarter(self):
"""
This test checks the correctness of the Nordsieck array generated
from a RK starter
"""
pass
"""
A=np.array([[0.,1.],[-4.,0.]])
def f(t,x,sw0):
return np.dot(A,np.array(x))
Expand All @@ -258,10 +258,9 @@ def f(t,x,sw0):
h=H/4.
nordsieck_at_0=np.array([coeff[-1,:],h*d1coeff[-1,:],h**2/2.*d2coeff[-1,:],
h**3/6.*d3coeff[-1,:],h**4/24.*d4coeff[-1,:]])
rkNordsieck=odepack.RKStarterNordsieck(f,H)
rkNordsieck=RKStarterNordsieck(f,H)
computed=rkNordsieck(0,y0)
numpy.testing.assert_allclose(computed[1], nordsieck_at_0, atol=H/100., verbose=True)
"""
np.testing.assert_allclose(computed[1], nordsieck_at_0, atol=H/100., verbose=True)

def test_interpol(self):
# a with interpolation and report_continuously
Expand Down
36 changes: 18 additions & 18 deletions tests/solvers/test_radau5.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,22 +213,22 @@ def jac(t,y):
cls.sim.inith = 1.e-4 #Initial step-size
cls.sim.usejac = False

@pytest.mark.skip("Does not support state events")
def test_event_localizer(self):
pass
# exp_mod = Extended_Problem() #Create the problem
exp_mod = Extended_Problem() #Create the problem

# exp_sim = _Radau5ODE(exp_mod) #Create the solver
exp_sim = _Radau5ODE(exp_mod) #Create the solver

# exp_sim.verbosity = 0
# exp_sim.report_continuously = True
exp_sim.verbosity = 0
exp_sim.report_continuously = True

# #Simulate
# t, y = exp_sim.simulate(10.0,1000) #Simulate 10 seconds with 1000 communications points
#Simulate
t, y = exp_sim.simulate(10.0,1000) #Simulate 10 seconds with 1000 communications points

# #Basic test
# assert y[-1][0] == pytest.approx(8.0)
# assert y[-1][1] == pytest.approx(3.0)
# assert y[-1][2] == pytest.approx(2.0)
#Basic test
assert y[-1][0] == pytest.approx(8.0)
assert y[-1][1] == pytest.approx(3.0)
assert y[-1][2] == pytest.approx(2.0)

def test_time_event(self):
f = lambda t,y: [1.0]
Expand Down Expand Up @@ -638,17 +638,17 @@ def test_maxh(self):
self.sim.maxh = 0.01
self.sim.simulate(0.5)
assert max(np.diff(self.sim.t_sol))-np.finfo('double').eps <= 0.01


@pytest.mark.skip("Statistic not recorded by Radau5")
def test_newt(self):
"""
This tests the maximum number of newton iterations.
"""
pass
# self.sim.simulate(1.0)
# self.sim.reset()
# self.sim.newt = 10
# self.sim.simulate(1.0)
# assert self.sim.statistics["nniterfail"] == 1
self.sim.simulate(1.0)
self.sim.reset()
self.sim.newt = 10
self.sim.simulate(1.0)
assert self.sim.statistics["nniterfail"] == 1

def test_safe(self):
"""
Expand Down

0 comments on commit 4a349ff

Please sign in to comment.