Ejemplo n.º 1
0
def test_ensure_single_arg_constant_function():
    const = ensure_single_arg_constant_function(4)
    assert callable(const)
    assert const(1) == 4
    func = ensure_single_arg_constant_function(lambda x: 5)
    assert callable(func)
    assert func(1) == 5
Ejemplo n.º 2
0
 def vol(self, value):
     check_numeric_or_single_arg_callable(value, "vol")
     self._vol = ensure_single_arg_constant_function(value)
Ejemplo n.º 3
0
 def mean(self, value):
     check_numeric_or_single_arg_callable(value, "mean")
     self._mean = ensure_single_arg_constant_function(value)
Ejemplo n.º 4
0
 def speed(self, value):
     check_numeric_or_single_arg_callable(value, "speed")
     self._speed = ensure_single_arg_constant_function(value)
 def drift(self, value):
     check_numeric(value, "Drift coefficient.")
     self._drift = ensure_single_arg_constant_function(value)
     self.speed = ensure_single_arg_constant_function(-value)