remove dupe tests
This commit is contained in:
parent
120c965d4f
commit
5f9d1f11c4
1 changed files with 0 additions and 44 deletions
|
|
@ -66,47 +66,3 @@ class TestCustomFunction:
|
||||||
"output": "{%cycle_func0(1)}",
|
"output": "{%cycle_func0(1)}",
|
||||||
}
|
}
|
||||||
).resolve()
|
).resolve()
|
||||||
|
|
||||||
def test_lambda_with_custom_function(self):
|
|
||||||
assert Script(
|
|
||||||
{"%times_two": "{%mul($0, 2)}", "wip": "{%array_apply([1, 2, 3], %times_two)}"}
|
|
||||||
).resolve() == {"wip": ResolvedArray([Integer(2), Integer(4), Integer(6)])}
|
|
||||||
|
|
||||||
def test_conditional_lambda_with_custom_functions(self):
|
|
||||||
assert Script(
|
|
||||||
{
|
|
||||||
"%times_three": "{%mul($0, 3)}",
|
|
||||||
"%times_two": "{%mul($0, 2)}",
|
|
||||||
"wip": "{%array_apply([1, 2, 3], %if(False, %times_two, %times_three))}",
|
|
||||||
}
|
|
||||||
).resolve() == {"wip": ResolvedArray([Integer(3), Integer(6), Integer(9)])}
|
|
||||||
|
|
||||||
def test_nested_custom_functions(self):
|
|
||||||
assert Script(
|
|
||||||
{
|
|
||||||
"%times_three": "{%mul($0, 3)}",
|
|
||||||
"%times_two": "{%mul($0, 2)}",
|
|
||||||
"identity": "{%times_three(%times_two(1))}",
|
|
||||||
}
|
|
||||||
).resolve() == {"identity": Integer(6)}
|
|
||||||
|
|
||||||
def test_nested_custom_functions_within_custom_functions(self):
|
|
||||||
assert Script(
|
|
||||||
{
|
|
||||||
"%power_2": "{%mul($0, 2)}",
|
|
||||||
"%power_3": "{%mul(%power_2($0), 2)}",
|
|
||||||
"%power_4": "{%mul(%power_3($0), 2)}",
|
|
||||||
"power_of_4": "{%power_4(2)}",
|
|
||||||
}
|
|
||||||
).resolve() == {"power_of_4": Integer(16)}
|
|
||||||
|
|
||||||
def test_nested_lambda_custom_functions_within_custom_functions(self):
|
|
||||||
assert Script(
|
|
||||||
{
|
|
||||||
"%nest4": "{%mul($0, 2)}",
|
|
||||||
"%nest3": "{%array_at(%array_apply([$0], %nest4), 0)}",
|
|
||||||
"%nest2": "{%array_at(%array_apply([$0], %nest3), 0)}",
|
|
||||||
"%nest1": "{%array_at(%array_apply([$0], %nest2), 0)}",
|
|
||||||
"output": "{%array_at(%array_apply([2], %nest1), 0)}",
|
|
||||||
}
|
|
||||||
).resolve() == {"output": Integer(4)}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue