def test_dynamic_parameter(bounds): a = DynamicParameter("c.b.a", bounds=bounds, default=0.5) a.value = 0.1 assert a.value == 1 + bounds[0] assert a.transform(0) == bounds[0] assert a.transform(1) == bounds[1] a.value = 1.1 assert np.isnan(a.value)
def test_parameter_function(): a = DynamicParameter("test", transformation=lambda x, a, b: x / (1 - x + sys.float_info.min)) assert a.transform(0.5) == 1