From f376a261c8ef19a524c0010bd3e666107fb493c9 Mon Sep 17 00:00:00 2001 From: Sherelyn Alejandro <80668767+SherelynA@users.noreply.github.com> Date: Mon, 4 Nov 2024 17:00:45 -0500 Subject: [PATCH] Adding More Tests Co-authored-by: Kelle Cruz --- sedkit/tests/test_isochrone.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sedkit/tests/test_isochrone.py b/sedkit/tests/test_isochrone.py index d2e4b22..039c089 100644 --- a/sedkit/tests/test_isochrone.py +++ b/sedkit/tests/test_isochrone.py @@ -7,18 +7,19 @@ from .. import utilities as u -@pytest.mark.parametrize('xval,age,xparam,yparam', [ - ((-4, 0.1), (4 * q.Gyr, 0.1 * q.Gyr), 'Lbol', 'mass'), # With uncertainties - (-4, (4 * q.Gyr, 0.1 * q.Gyr), 'Lbol', 'mass'), # No xparam uncertainty - ((-4, 0.1), 4 * q.Gyr, 'Lbol', 'mass'), # No yparam uncertainty - (-4, 4 * q.Gyr, 'Lbol', 'mass') # No xparam and yparam uncertainties +@pytest.mark.parametrize('xval,age,xparam,yparam,expected_result', [ + ((-4, 0.1), (4 * q.Gyr, 0.1 * q.Gyr), 'Lbol', 'mass',0.072), # With uncertainties + (-4, (4 * q.Gyr, 0.1 * q.Gyr), 'Lbol', 'mass',0.072), # No xparam uncertainty + ((-4, 0.1), 4 * q.Gyr, 'Lbol', 'mass',0.072), # No yparam uncertainty + (-4, 4 * q.Gyr, 'Lbol', 'mass',0.020) # No xparam and yparam uncertainties ]) -def test_evaluate( xval, age, xparam, yparam): +def test_evaluate( xval, age, xparam, yparam,expected_result): # average, lower, upper """Test the evaluate method""" hsa = iso.Isochrone('hybrid_solar_age') result = hsa.evaluate(xval, age, xparam, yparam) assert (isinstance(result, tuple)) is True + assert (np.isclose(result[0].value, expected_result, atol=0.005)) # assert (np.isclose(result[0],value,)) # try == first but if it can't happen then use isclose # test the value of the y param uncertainties (the three values - lower,average and upper)