need to detect custom func cycle, WIP
This commit is contained in:
parent
2aa24ba67e
commit
d10bd68ba6
1 changed files with 12 additions and 0 deletions
|
|
@ -126,6 +126,18 @@ class TestFunction:
|
||||||
{"%cycle_func": "{%mul(%cycle_func(1), $0)}", "output": "{%cycle_func(1)}"}
|
{"%cycle_func": "{%mul(%cycle_func(1), $0)}", "output": "{%cycle_func(1)}"}
|
||||||
).resolve()
|
).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):
|
def test_lambda_with_custom_function(self):
|
||||||
assert Script(
|
assert Script(
|
||||||
{"%times_two": "{%mul($0, 2)}", "wip": "{%array_apply([1, 2, 3], %times_two)}"}
|
{"%times_two": "{%mul($0, 2)}", "wip": "{%array_apply([1, 2, 3], %times_two)}"}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue