Skip to content

Commit

Permalink
Add test for makeEulerErrorFunc
Browse files Browse the repository at this point in the history
  • Loading branch information
mnwhite committed Dec 10, 2024
1 parent 11f3eda commit b399d87
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion HARK/ConsumptionSaving/tests/test_IndShockConsumerType.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,15 @@ def test_infinite_horizon(self):


class testIndShockConsumerTypeExample(unittest.TestCase):
def test_infinite_horizon(self):
def setUp(self):
IndShockExample = IndShockConsumerType(**IdiosyncDict)
IndShockExample.assign_parameters(
cycles=0
) # Make this type have an infinite horizon
self.IndShockExample = IndShockExample

def test_infinite_horizon(self):
IndShockExample = self.IndShockExample
IndShockExample.solve()

self.assertAlmostEqual(
Expand All @@ -238,6 +242,14 @@ def test_infinite_horizon(self):
# simulation test -- seed/generator specific
# self.assertAlmostEqual( # IndShockExample.history["mNrm"][0][0], 1.01702, place = HARK_PRECISION # )

def test_euler_error_function(self):
IndShockExample = self.IndShockExample
IndShockExample.solve()
IndShockExample.make_euler_error_func()
self.assertAlmostEqual(
IndShockExample.eulerErrorFunc(5.0), -5.9e-5, places=HARK_PRECISION
)


LifecycleDict = { # Click arrow to expand this fairly large parameter dictionary
# Parameters shared with the perfect foresight model
Expand Down

0 comments on commit b399d87

Please sign in to comment.