示例#1
0
    [
        Debug(),
        RandomGaussian(),
        RandomBinary(),
        RandomSymmetricDirichlet(),
        BinaryMarkovChain(0.1, 0.1),
        Constant(1),
        LinearTrend(),
        RandomCat([10]),
        Lag("foo", 1),
        ForEachCat(RandomGaussian()),
        Eval("np.random.rand(length)"),
        SmoothSeasonality(Constant(12), Constant(0)),
        Add(["foo", "foo"]),
        Mul(["foo", "foo"]),
        NanWhere("foo", "foo"),
        Stack([Ref("foo"), Ref("foo")]),
        RandomGaussian() + RandomGaussian(),
        RandomGaussian() * RandomGaussian(),
        RandomGaussian() / RandomGaussian(),
    ],
)
def test_call_and_repr(func) -> None:
    global_state = {}
    x = evaluate(BASE_RECIPE, length=10, global_state=global_state)
    kwargs = dict(foo=42, bar=23)
    np.random.seed(0)
    ret = func(
        x,
        field_name="bar",
        length=10,
示例#2
0
    [
        Debug(),
        RandomGaussian(),
        RandomBinary(),
        RandomSymmetricDirichlet(),
        BinaryMarkovChain(0.1, 0.1),
        Constant(1),
        LinearTrend(),
        RandomCat([10]),
        Lag("foo", 1),
        ForEachCat(RandomGaussian()),
        Expr("np.random.rand(length)"),
        SmoothSeasonality(Constant(12), Constant(0)),
        Add(['foo', 'foo']),
        Mul(['foo', 'foo']),
        NanWhere('foo', 'foo'),
        NanWhereNot('foo', 'foo'),
        Stack(['foo', 'foo']),
        RandomGaussian() + RandomGaussian(),
        RandomGaussian() * RandomGaussian(),
        RandomGaussian() / RandomGaussian(),
    ],
)
def test_call_and_repr(func) -> None:
    global_state = {}
    x = evaluate_recipe(BASE_RECIPE, length=10, global_state=global_state)
    kwargs = dict(foo=42, bar=23)
    np.random.seed(0)
    ret = func(
        x,
        field_name='bar',