Changed expression evaluation opening and closing pattern.
This commit is contained in:
@@ -195,8 +195,8 @@ Export attribute
|
||||
key:
|
||||
- GID-1510554_step_1
|
||||
report:
|
||||
reported_list: <@ random.sample(range(0,20), k=10) @>
|
||||
reported_float: <@ math.sqrt(float(1)) @>
|
||||
reported_list: @| random.sample(range(0,20), k=10) |
|
||||
reported_float: @| math.sqrt(float(1)) |
|
||||
reported_str: This is my reported sentence
|
||||
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ The parameter file can be specified in the `.tum` file root:
|
||||
|
||||
parameter1: value1
|
||||
parameter2: 1234
|
||||
parameter3: <@ 12.34 * 2 @>
|
||||
parameter3: @| 12.34 * 2 |
|
||||
parameter4:
|
||||
- $(parameter1)
|
||||
- $(parameter3)
|
||||
@@ -202,7 +202,7 @@ The variable substitution is recursive and checks all the occurrences of the
|
||||
``$(x)`` pattern in a string.
|
||||
|
||||
It is also possible to perform evaluation of python substrings during parameters passing.
|
||||
It is done by using the ``<@ expr @>`` pattern in a string.
|
||||
It is done by using the ``@| expr |`` pattern in a string.
|
||||
`expr` may then be a correct python expression.
|
||||
|
||||
Below are illustrated simple and more complicated cases of expansion and evaluation depending on
|
||||
@@ -215,10 +215,10 @@ their pattern.
|
||||
name: Dynamic variables expansion
|
||||
key: $(test)_PASS
|
||||
values:
|
||||
- expanse_select: <@"$(expanse_select)".replace("o", "a")@>
|
||||
- expanse_select: @|"$(expanse_select)".replace("o", "a")|
|
||||
- expanse_index: $(expanse_index_$(expanse_select))
|
||||
- expanse_table: $(expanse_table_$(expanse_select))
|
||||
- expanse_eval: <@$(expanse_index) == 1@>
|
||||
- expanse_eval: @|$(expanse_index) == 1|
|
||||
|
||||
Test Items
|
||||
--------------------
|
||||
|
||||
@@ -313,12 +313,12 @@ def _preprocess_string(value, parent=None):
|
||||
|
||||
def _eval_param(value):
|
||||
"""This function parses a string value to check if patterns corresponding
|
||||
to <@xxx@ exists.
|
||||
to @|xxx| exists.
|
||||
When this kind of pattern is found, an attempt to evaluate its
|
||||
content is done.
|
||||
If it is not evaluable, not replaced.
|
||||
"""
|
||||
return _parse_and_process("<@", "@>", value, evaluate)
|
||||
return _parse_and_process("@|", "|", value, evaluate)
|
||||
|
||||
|
||||
def _process_recursively(func, param_value, *fparams):
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
|
||||
- py_func:
|
||||
name: Return True expect False but no_fail expansed
|
||||
no_fail: <@ bool(0) == False @>
|
||||
no_fail: @| bool(0) == False |
|
||||
key: $(test)_PASS
|
||||
file: $(test_path)$(psep)results$(psep)results.py
|
||||
func_name: echo
|
||||
@@ -147,7 +147,7 @@
|
||||
|
||||
- py_func:
|
||||
name: Return True expect False but no_fail expansed (must fail)
|
||||
no_fail: <@ bool(1) == False @>
|
||||
no_fail: @| bool(1) == False |
|
||||
key: $(test)_FAIL
|
||||
file: $(test_path)$(psep)results$(psep)results.py
|
||||
func_name: echo
|
||||
|
||||
@@ -9,4 +9,4 @@ expanse_index_blo: 1
|
||||
expanse_index: $(expanse_index_$(expanse_select))
|
||||
expanse_table: $(expanse_table_$(expanse_select))
|
||||
|
||||
expanse_eval: <@$(expanse_index) == 1@>
|
||||
expanse_eval: @|$(expanse_index) == 1|
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
name: Dynamic variables expansion
|
||||
key: $(test)_PASS
|
||||
values:
|
||||
- expanse_select: <@"$(expanse_select)".replace("o", "a")@>
|
||||
- expanse_select: @|"$(expanse_select)".replace("o", "a")|
|
||||
- expanse_index: $(expanse_index_$(expanse_select))
|
||||
- expanse_table: $(expanse_table_$(expanse_select))
|
||||
- expanse_eval: <@$(expanse_index) == 1@>
|
||||
- expanse_eval: @|$(expanse_index) == 1|
|
||||
|
||||
- check:
|
||||
name: Check variables expansion is correct (PASS)
|
||||
@@ -33,7 +33,7 @@
|
||||
- var4: blo
|
||||
- expanse_var_bla: 3
|
||||
- expanse_blo_var: 5
|
||||
- expanse_complex: <@<@$(expanse_$(var2)_$(var3))*6@> + <@4*$($(var1)_$(var4)_$(var2))@>@>
|
||||
- expanse_complex: @|@|$(expanse_$(var2)_$(var3))*6| + @|4*$($(var1)_$(var4)_$(var2))||
|
||||
|
||||
- check:
|
||||
name: Check complex variables expansion is correct (PASS)
|
||||
@@ -50,10 +50,10 @@
|
||||
- expanse_var_2: 6
|
||||
- expanse_object:
|
||||
[
|
||||
{ a: $(expanse_var_2), $(expanse_key): <@2**3@> },
|
||||
{ a: $(expanse_var_2), $(expanse_key): @|2**3| },
|
||||
{
|
||||
'<@"bla".replace("a", "o")@>':
|
||||
[<@$(expanse_var)*$(expanse_var_2)@>, 25],
|
||||
'@|"bla".replace("a", "o")|':
|
||||
[@|$(expanse_var)*$(expanse_var_2)|, 25],
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# All sub directory in items are evaluated as a list
|
||||
items: <@ [os.path.basename(f.path) for f in os.scandir(os.path.join(r"$(test_directory)", "items")) if f.is_dir()] @>
|
||||
items: @| [os.path.basename(f.path) for f in os.scandir(os.path.join(r"$(test_directory)", "items")) if f.is_dir()] |
|
||||
# - common
|
||||
# - check
|
||||
# - console
|
||||
|
||||
Reference in New Issue
Block a user