Beispiel #1
0
def test_none(func=func0, seed=42):
    np.random.seed(seed)
    args = None
    kwargs = None
    wrapped = _FunctionWrapper(func, args, kwargs)
    ndim = np.random.randint(2, 200)
    x = np.random.rand(ndim)
    assert np.allclose(wrapped(x), func(x))
Beispiel #2
0
def test_kwargs1(func=func1, seed=42):
    np.random.seed(seed)
    ndim = np.random.randint(2, 200)
    mu = np.random.rand(ndim)
    args = None
    kwargs = {'mu': mu}
    wrapped = _FunctionWrapper(func, args, kwargs)
    x = np.random.rand(ndim)
    assert np.allclose(wrapped(x), func(x, mu))
Beispiel #3
0
def test_argskwargs(func=func2, seed=42):
    np.random.seed(seed)
    ndim = np.random.randint(2, 200)
    mu = np.random.rand(ndim)
    ivar = 1.0 / np.random.rand(ndim)
    args = [mu]
    kwargs = {'ivar': ivar}
    wrapped = _FunctionWrapper(func, args, kwargs)
    x = np.random.rand(ndim)
    assert np.allclose(wrapped(x), func(x, mu, ivar))