need to detect custom func cycle, WIP

This commit is contained in:
Jesse Bannon 2023-11-21 18:28:44 -08:00
parent 2aa24ba67e
commit d10bd68ba6

View file

@ -126,6 +126,18 @@ class TestFunction:
{"%cycle_func": "{%mul(%cycle_func(1), $0)}", "output": "{%cycle_func(1)}"}
).resolve()
def test_custom_function_chained_cycle(self):
with pytest.raises(
CycleDetected, match=re.escape("The custom function %cycle_func cannot call itself.")
):
Script(
{
"%cycle_func1": "{%mul(%cycle_func0(1), $0)}",
"%cycle_func0": "{%mul(%cycle_func1(1), $0)}",
"output": "{%cycle_func0(1)}",
}
).resolve()
def test_lambda_with_custom_function(self):
assert Script(
{"%times_two": "{%mul($0, 2)}", "wip": "{%array_apply([1, 2, 3], %times_two)}"}