Skip to content

Commit

Permalink
Adding More Tests
Browse files Browse the repository at this point in the history
Co-authored-by: Kelle Cruz <[email protected]>
  • Loading branch information
SherelynA and kelle authored Nov 4, 2024
1 parent ccc0eae commit f376a26
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions sedkit/tests/test_isochrone.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f376a26

Please sign in to comment.