diff --git a/tests/solvers/test_odepack.py b/tests/solvers/test_odepack.py index d3985fdc..d7ba9ab6 100644 --- a/tests/solvers/test_odepack.py +++ b/tests/solvers/test_odepack.py @@ -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 @@ -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)) @@ -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 diff --git a/tests/solvers/test_radau5.py b/tests/solvers/test_radau5.py index 5160a241..8259c9fb 100644 --- a/tests/solvers/test_radau5.py +++ b/tests/solvers/test_radau5.py @@ -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] @@ -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): """