Ejemplo n.º 1
0
def test_inline_prohibit_async():

    async def func(x):
        return x

    with pytest.raises(ValueError):
        func = inline(func)
Ejemplo n.º 2
0
def test_inline_prohibit_nested_definitions():

    def func(x):
        return lambda y: x + y

    with pytest.raises(ValueError):
        func = inline(func)
Ejemplo n.º 3
0
def test_inline_prohibit_generator():

    def func(x):
        for i in range(x):
            yield i

    with pytest.raises(ValueError):
        func = inline(func)
Ejemplo n.º 4
0
def test_inline_prohibit_closure():

    @inline
    def no_closure(x):
        return x

    assert get_inline_tag(no_closure)

    a = 1

    def with_closure(x):
        return x + a

    with pytest.raises(ValueError):
        with_closure = inline(with_closure)