From b3baff42a2391e65e7b6dacd7e09ef7eb6bf4878 Mon Sep 17 00:00:00 2001 From: "Matthew N. White" Date: Tue, 20 Feb 2024 14:43:14 -0500 Subject: [PATCH] Add test for make_figs() --- HARK/tests/test_HARKutilities.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/HARK/tests/test_HARKutilities.py b/HARK/tests/test_HARKutilities.py index 2c9e27fc8..95be07999 100644 --- a/HARK/tests/test_HARKutilities.py +++ b/HARK/tests/test_HARKutilities.py @@ -3,6 +3,7 @@ """ # Bring in modules we need import unittest +import matplotlib.pyplot as plt from types import SimpleNamespace import numpy as np @@ -14,7 +15,7 @@ CRRAutilityPPP, CRRAutilityPPPP, ) -from HARK.utilities import construct_assets_grid +from HARK.utilities import construct_assets_grid, make_figs class testsForHARKutilities(unittest.TestCase): @@ -66,7 +67,7 @@ def test_CRRAutilityPPPP(self): self.derivative_func_comparison(CRRAutilityPPPP, CRRAutilityPPP) def test_asset_grid(self): - # test linear asset grid + # Test linear asset grid params = { "aXtraMin": 0.0, @@ -83,3 +84,10 @@ def test_asset_grid(self): test = np.unique(np.diff(aXtraGrid).round(decimals=3)) self.assertEqual(test.size, 1) + + def test_make_figs(self): + # Test the make_figs() function with a trivial output + plt.figure() + plt.plot(np.linspace(1,5,40),np.linspace(4,8,40) ) + make_figs('test', True , False, target_dir='') + plt.clf()