More tests for the IndShockConsumerType LifecycleExample
@@ -35,6 +35,19 @@ class testIndShockConsumerType(unittest.TestCase):
LifecycleExample.cycles = 1
LifecycleExample.solve()
+ # test the solution_terminal
+ self.assertAlmostEqual(
+ LifecycleExample.solution[10].cFunc(2).tolist(),
+ 2)
+
+
+ self.assertAlmostEqual(LifecycleExample.solution[9].cFunc(1),
+ 0.97769632)
+ self.assertAlmostEqual(LifecycleExample.solution[8].cFunc(1),
+ 0.96624445)
+ self.assertAlmostEqual(LifecycleExample.solution[7].cFunc(1),
+ 0.95691449)
+
self.assertAlmostEqual(
LifecycleExample.solution[0].cFunc(1).tolist(),
0.87362789)
@@ -45,11 +58,6 @@ class testIndShockConsumerType(unittest.TestCase):
LifecycleExample.solution[2].cFunc(1).tolist(),
0.9563899)
- # test the solution_terminal
- self.assertAlmostEqual(
- LifecycleExample.solution[10].cFunc(2).tolist(),
- 2)
-
solver = ConsIndShockSolverBasic(
LifecycleExample.solution[-2],
LifecycleExample.IncomeDstn[0],
