def test_peval_prohibit_async(): async def f(x): return x with pytest.raises(ValueError): ff = partial_eval(f)
def test_peval_prohibit_nested_definitions(): def f(x): g = lambda y: x + y return g(x) with pytest.raises(ValueError): ff = partial_eval(f)
def test_peval_closure(): a = 1 b = 2 def f(x): return x + (a + b) ff = partial_eval(f) assert ff(1) == 1 + a + b