diff --git a/HARK/tests/test_HARKutilities.py b/HARK/tests/test_HARKutilities.py index 2c9e27fc8..a21ed3712 100644 --- a/HARK/tests/test_HARKutilities.py +++ b/HARK/tests/test_HARKutilities.py @@ -5,6 +5,7 @@ import unittest from types import SimpleNamespace +import matplotlib.pyplot as plt import numpy as np from HARK.rewards import ( @@ -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() diff --git a/HARK/utilities.py b/HARK/utilities.py index 520dfc7dc..96181fbb9 100644 --- a/HARK/utilities.py +++ b/HARK/utilities.py @@ -1006,7 +1006,7 @@ def make_figs(figure_name, saveFigs, drawFigs, target_dir="Figures"): print(f"Saving figure {figure_name} in {target_dir}") plt.savefig( os.path.join(target_dir, f"{figure_name}.jpg"), - metadata={"CreationDate": None}, + # metadata is not supported for jpg ) # For web/html plt.savefig( os.path.join(target_dir, f"{figure_name}.png"),