@@ -61,6 +61,32 @@ def test_libraries(pop_and_params):
6161 assert dlib == pop .duste_library
6262
6363
64+ def test_param_checks (pop_and_params ):
65+ pop , params = pop_and_params
66+ _reset_default_params (pop , params )
67+ pop .params ["sfh" ] = 1
68+ pop .params ["tage" ] = 2
69+ pop .params ["sf_start" ] = 0.5
70+ # this should never raise an error:
71+ w , s = pop .get_spectrum (tage = pop .params ["tage" ])
72+ # this used to raise an assertion error in the setter:
73+ pop .params ["sf_start" ] = 2.1
74+ # this also used to raise an assertion error in the setter:
75+ pop .params ["imf_type" ] = 8
76+ # fix the IMF issue but leave the sf_start error
77+ pop .params ["imf_type" ] = 1
78+ try :
79+ # This *should* still raise an AssertionError
80+ w , s = pop .get_spectrum (tage = pop .params ["tage" ])
81+ # Hacky way to make sure the AssertionError still got thrown
82+ raise ValueError ("Did not throw exception for invalid sf_start > tage" )
83+ except (AssertionError ):
84+ pass
85+ pop .params ["tage" ] = 1.0
86+ pop .params ["sf_start" ] = 0.1
87+ w , s = pop .get_spectrum (tage = pop .params ["tage" ])
88+
89+
6490def test_filters ():
6591 """Test all the filters got transmission data loaded."""
6692 flist = filters .list_filters ()
0 commit comments