Changed (once again) the evaluation delimiters (<| and |>)

This commit is contained in:
2026-02-13 18:51:49 +01:00
parent a6058b9dd8
commit 899857767a
21 changed files with 71 additions and 70 deletions

View File

@@ -10,12 +10,12 @@ main:
- let: - let:
name: Set test variables for Linux name: Set test variables for Linux
condition: $| "$(os)" == "Linux" | condition: <| "$(os)" == "Linux" |>
values: values:
- terminal_prompt: $(linux_prompt) - terminal_prompt: $(linux_prompt)
- let: - let:
name: Set test variables for Windows name: Set test variables for Windows
condition: $| "$(os)" == "Windows" | condition: <| "$(os)" == "Windows" |>
values: values:
- terminal_prompt: $(windows_prompt) - terminal_prompt: $(windows_prompt)
@@ -35,17 +35,17 @@ main:
no_fail: True no_fail: True
exit_condition: exit_condition:
value: $| "$(last_test_result)" == "PASS" | value: <| "$(last_test_result)" == "PASS" |>
- let: - let:
name: let name: let
values: values:
- conditional_exec: $| random.randint(1, 4) | - conditional_exec: <| random.randint(1, 4) |>
- console: - console:
name: Console creation name: Console creation
condition: $| $(conditional_exec) == 1 | condition: <| $(conditional_exec) == 1 |>
console_name: consname console_name: consname
doc: Opening the console doc: Opening the console
steps: steps:
@@ -55,56 +55,56 @@ main:
- console: - console:
name: Console read_until with timeout name: Console read_until with timeout
condition: $| $(conditional_exec) == 1 | condition: <| $(conditional_exec) == 1 |>
console_name: consname console_name: consname
steps: steps:
- read_until: {expected: "$(terminal_prompt)", timeout: 10} - read_until: {expected: "$(terminal_prompt)", timeout: 10}
- console: - console:
name: Console write name: Console write
condition: $| $(conditional_exec) == 1 | condition: <| $(conditional_exec) == 1 |>
console_name: consname console_name: consname
steps: steps:
- writeln: echo 0 - writeln: echo 0
- sleep: - sleep:
name: sleep item name: sleep item
condition: $| $(conditional_exec) == 1 | condition: <| $(conditional_exec) == 1 |>
timeout: 5 timeout: 5
- console: - console:
name: Console read_until immediate name: Console read_until immediate
condition: $| $(conditional_exec) == 1 | condition: <| $(conditional_exec) == 1 |>
console_name: consname console_name: consname
steps: steps:
- read_until: {expected: "0", timeout: 0} - read_until: {expected: "0", timeout: 0}
- console: - console:
name: Console read_until immediate (2) name: Console read_until immediate (2)
condition: $| $(conditional_exec) == 1 | condition: <| $(conditional_exec) == 1 |>
console_name: consname console_name: consname
steps: steps:
- read_until: {expected: "$(terminal_prompt)", timeout: 0} - read_until: {expected: "$(terminal_prompt)", timeout: 0}
- console: - console:
name: Console closure name: Console closure
condition: $| $(conditional_exec) == 1 | condition: <| $(conditional_exec) == 1 |>
console_name: consname console_name: consname
steps: steps:
- close: consname - close: consname
- sleep: - sleep:
name: sleep item name: sleep item
condition: $| $(conditional_exec) == 2 | condition: <| $(conditional_exec) == 2 |>
timeout: 5 timeout: 5
- dialog_image: - dialog_image:
name: dialog image item name: dialog image item
condition: $| $(conditional_exec) == 3 | condition: <| $(conditional_exec) == 3 |>
question: click ok if you see the image question: click ok if you see the image
filename: image.jpg filename: image.jpg
- dialog_value: - dialog_value:
name: dialog_value item name: dialog_value item
condition: $| $(conditional_exec) == 4 | condition: <| $(conditional_exec) == 4 |>
question: enter something and click ok question: enter something and click ok

View File

@@ -139,7 +139,7 @@ main:
timeout: 0.2 timeout: 0.2
dialog: false dialog: false
exit_condition: exit_condition:
value: $| $(variable) >= 10 | value: <| $(variable) >= 10 |>
# This loop must fail du to an exception in exit condition. # This loop must fail du to an exception in exit condition.
- loop: - loop:

View File

@@ -16,7 +16,7 @@ main:
- group: - group:
name: Set test variables for Linux name: Set test variables for Linux
condition: $| "$(os)" == "Linux" | condition: <| "$(os)" == "Linux" |>
steps: steps:
- let: - let:
@@ -26,7 +26,7 @@ main:
- group: - group:
name: Set test variables for Windows name: Set test variables for Windows
condition: $| "$(os)" == "Windows" | condition: <| "$(os)" == "Windows" |>
steps: steps:
- let: - let:

View File

@@ -22,6 +22,6 @@ main:
- *seq_sleep - *seq_sleep
exit_condition: exit_condition:
value: $| $(variable) >= 3 | value: <| $(variable) >= 3 |>
- !include {file: seq2.tum, is_dialog: True, sleep_timeout: 12, func_para: truc} - !include {file: seq2.tum, is_dialog: True, sleep_timeout: 12, func_para: truc}

View File

@@ -23,5 +23,5 @@ main:
- sleep: - sleep:
name: sleep item name: sleep item
dialog: true dialog: true
timeout: $| 3600 + random.randint(1, 10) | timeout: <| 3600 + random.randint(1, 10) |>
no_fail: true no_fail: true

View File

@@ -21,9 +21,9 @@ main:
- let: - let:
name: Extract data name: Extract data
values: values:
- text_extract: $| [l for l in '''$(rand_text)'''.splitlines() if '$(text_searched)' in l][0] | - text_extract: <| [l for l in '''$(rand_text)'''.splitlines() if '$(text_searched)' in l][0] |>
- dialog_message: - dialog_message:
condition: $| len('$(text_extract)') > 0 | condition: <| len('$(text_extract)') > 0 |>
name: dialog value test item name: dialog value test item
question: Tataaaaa ! question: Tataaaaa !

View File

@@ -8,7 +8,7 @@ This element is of the following form:
- group: - group:
name: Group Item name: Group Item
condition: $| "$(OS)" == "Linux" | condition: <| "$(OS)" == "Linux" |>
steps: steps:
- unittest_file: - unittest_file:
test_file: test_prod_alpha_13.py test_file: test_prod_alpha_13.py

View File

@@ -196,8 +196,8 @@ Export attribute
key: key:
- GID-1510554_step_1 - GID-1510554_step_1
report: report:
reported_list: $| random.sample(range(0,20), k=10) | reported_list: <| random.sample(range(0,20), k=10) |>
reported_float: $| math.sqrt(float(1)) | reported_float: <| math.sqrt(float(1)) |>
reported_str: This is my reported sentence reported_str: This is my reported sentence

View File

@@ -11,7 +11,7 @@ This element is of the following form:
values: values:
key1: value1 key1: value1
key2: value2 key2: value2
key3: $| $(variable)[$(loop_index)] | key3: <| $(variable)[$(loop_index)] |>
The ``let`` element is used to set values in the global directory. The ``let`` element is used to set values in the global directory.

View File

@@ -63,7 +63,7 @@ The parameter file can be specified in the `.tum` file root:
parameter1: value1 parameter1: value1
parameter2: 1234 parameter2: 1234
parameter3: $| 12.34 * 2 | parameter3: <| 12.34 * 2 |>
parameter4: parameter4:
- $(parameter1) - $(parameter1)
- $(parameter3) - $(parameter3)
@@ -205,7 +205,7 @@ The variable substitution is recursive and checks all the occurrences of the
``$(x)`` pattern in a string. ``$(x)`` pattern in a string.
It is also possible to perform evaluation of python substrings during parameters passing. 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. `expr` may then be a correct python expression.
Below are illustrated simple and more complicated cases of expansion and evaluation depending on Below are illustrated simple and more complicated cases of expansion and evaluation depending on
@@ -218,10 +218,10 @@ their pattern.
name: Dynamic variables expansion name: Dynamic variables expansion
key: $(test)_PASS key: $(test)_PASS
values: values:
- expanse_select: $|"$(expanse_select)".replace("o", "a")| - expanse_select: <|"$(expanse_select)".replace("o", "a")|>
- expanse_index: $(expanse_index_$(expanse_select)) - expanse_index: $(expanse_index_$(expanse_select))
- expanse_table: $(expanse_table_$(expanse_select)) - expanse_table: $(expanse_table_$(expanse_select))
- expanse_eval: $|$(expanse_index) == 1| - expanse_eval: <|$(expanse_index) == 1|>
Test Items Test Items
-------------------- --------------------

Binary file not shown.

View File

@@ -307,13 +307,13 @@ def _preprocess_string(value, parent=None):
def _eval_param(value): def _eval_param(value):
"""This function parses a string value to check if patterns corresponding """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 When this kind of pattern is found, an attempt to evaluate its
content is done. content is done.
If it is not evaluable, not replaced. If it is not evaluable, not replaced.
""" """
global glob_eval_func global glob_eval_func
return _parse_and_process("$|", "|", value, glob_eval_func) return _parse_and_process("<|", "|>", value, glob_eval_func)
def _process_recursively(func, param_value, *fparams): def _process_recursively(func, param_value, *fparams):

View File

@@ -19,10 +19,10 @@
name: Check condition on existing variable (PASS) name: Check condition on existing variable (PASS)
key: $(test)_PASS key: $(test)_PASS
values: values:
- $| $(pfn_Dummy_int) > 1 | - <| $(pfn_Dummy_int) > 1 |>
- check: - check:
name: Check condition on existing variable (FAIL) name: Check condition on existing variable (FAIL)
key: $(test)_FAIL key: $(test)_FAIL
values: values:
- $| "tailor" in "$(pfn_Dummy_str)" | - <| "tailor" in "$(pfn_Dummy_str)" |>

View File

@@ -16,17 +16,17 @@
- $(loop_param) - $(loop_param)
exit_condition: exit_condition:
value: $| $(pfn_Echo function) > 3 | value: <| $(pfn_Echo function) > 3 |>
- let: - let:
name: let name: let
key: $(test)_PASS key: $(test)_PASS
values: values:
- conditional_exec: $| random.randint(1, 2) | - conditional_exec: <| random.randint(1, 2) |>
- console: - console:
name: Console creation name: Console creation
condition: $| $(conditional_exec) == 1 | condition: <| $(conditional_exec) == 1 |>
console_name: consname console_name: consname
doc: Opening the console doc: Opening the console
key: $(test)_PASS key: $(test)_PASS
@@ -34,18 +34,19 @@
- open: - open:
protocol: terminal protocol: terminal
terminal_path: $(test_directory) terminal_path: $(test_directory)
- writeln: echo "terminal loaded"
- console: - console:
name: Console read_until with timeout name: Console read_until with timeout
condition: $| $(conditional_exec) == 1 | condition: <| $(conditional_exec) == 1 |>
console_name: consname console_name: consname
key: $(test)_PASS key: $(test)_PASS
steps: steps:
- read_until: {expected: "$(terminal_prompt)", timeout: 10} - read_until: {expected: terminal loaded, timeout: 5}
- console: - console:
name: Console write name: Console write
condition: $| $(conditional_exec) == 1 | condition: <| $(conditional_exec) == 1 |>
console_name: consname console_name: consname
key: $(test)_PASS key: $(test)_PASS
steps: steps:
@@ -53,12 +54,12 @@
- sleep: - sleep:
name: sleep item name: sleep item
condition: $| $(conditional_exec) == 1 | condition: <| $(conditional_exec) == 1 |>
timeout: 1 timeout: 1
- console: - console:
name: Console read_until immediate name: Console read_until immediate
condition: $| $(conditional_exec) == 1 | condition: <| $(conditional_exec) == 1 |>
console_name: consname console_name: consname
key: $(test)_PASS key: $(test)_PASS
steps: steps:
@@ -66,7 +67,7 @@
- console: - console:
name: Console read_until immediate (2) name: Console read_until immediate (2)
condition: $| $(conditional_exec) == 1 | condition: <| $(conditional_exec) == 1 |>
console_name: consname console_name: consname
key: $(test)_PASS key: $(test)_PASS
steps: steps:
@@ -74,7 +75,7 @@
- console: - console:
name: Console closure name: Console closure
condition: $| $(conditional_exec) == 1 | condition: <| $(conditional_exec) == 1 |>
console_name: consname console_name: consname
key: $(test)_PASS key: $(test)_PASS
steps: steps:
@@ -82,5 +83,5 @@
- sleep: - sleep:
name: sleep item name: sleep item
condition: $| $(conditional_exec) == 2 | condition: <| $(conditional_exec) == 2 |>
timeout: 1 timeout: 1

View File

@@ -138,7 +138,7 @@
- py_func: - py_func:
name: Return True expect False but no_fail expansed name: Return True expect False but no_fail expansed
no_fail: $| bool(0) == False | no_fail: <| bool(0) == False |>
key: $(test)_PASS key: $(test)_PASS
file: $(test_path)$(psep)results$(psep)results.py file: $(test_path)$(psep)results$(psep)results.py
func_name: echo func_name: echo
@@ -147,7 +147,7 @@
- py_func: - py_func:
name: Return True expect False but no_fail expansed (must fail) name: Return True expect False but no_fail expansed (must fail)
no_fail: $| bool(1) == False | no_fail: <| bool(1) == False |>
key: $(test)_FAIL key: $(test)_FAIL
file: $(test_path)$(psep)results$(psep)results.py file: $(test_path)$(psep)results$(psep)results.py
func_name: echo func_name: echo

View File

@@ -9,4 +9,4 @@ expanse_index_blo: 1
expanse_index: $(expanse_index_$(expanse_select)) expanse_index: $(expanse_index_$(expanse_select))
expanse_table: $(expanse_table_$(expanse_select)) expanse_table: $(expanse_table_$(expanse_select))
expanse_eval: $|$(expanse_index) == 1| expanse_eval: <|$(expanse_index) == 1|>

View File

@@ -2,26 +2,26 @@
name: Check variables expansion is correct (PASS) name: Check variables expansion is correct (PASS)
key: $(test)_PASS key: $(test)_PASS
values: values:
- $(expanse_index) == 1 - <| $(expanse_index) == 1 |>
- $(expanse_table)[$(expanse_index)] == 9012 - <| $(expanse_table)[$(expanse_index)] == 9012 |>
- $(expanse_eval) == True - <| $(expanse_eval) == True |>
- let: - let:
name: Dynamic variables expansion name: Dynamic variables expansion
key: $(test)_PASS key: $(test)_PASS
values: values:
- expanse_select: $|"$(expanse_select)".replace("o", "a")| - expanse_select: <|"$(expanse_select)".replace("o", "a")|>
- expanse_index: $(expanse_index_$(expanse_select)) - expanse_index: $(expanse_index_$(expanse_select))
- expanse_table: $(expanse_table_$(expanse_select)) - expanse_table: $(expanse_table_$(expanse_select))
- expanse_eval: $|$(expanse_index) == 1| - expanse_eval: <|$(expanse_index) == 1|>
- check: - check:
name: Check variables expansion is correct (PASS) name: Check variables expansion is correct (PASS)
key: $(test)_PASS key: $(test)_PASS
values: values:
- $(expanse_index) == 0 - <| $(expanse_index) == 0 |>
- $(expanse_table)[$(expanse_index)] == "abcd" - <| $(expanse_table)[$(expanse_index)] == "abcd" |>
- $(expanse_eval) == False - <| $(expanse_eval) == False |>
- let: - let:
name: Complex variables expansion name: Complex variables expansion
@@ -33,13 +33,13 @@
- var4: blo - var4: blo
- expanse_var_bla: 3 - expanse_var_bla: 3
- expanse_blo_var: 5 - 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: - check:
name: Check complex variables expansion is correct (PASS) name: Check complex variables expansion is correct (PASS)
key: $(test)_PASS key: $(test)_PASS
values: values:
- $| $(expanse_complex) == 38 | - <| $(expanse_complex) == 38 |>
- let: - let:
name: Variables expansion in object name: Variables expansion in object
@@ -50,10 +50,10 @@
- expanse_var_2: 6 - expanse_var_2: 6
- expanse_object: - expanse_object:
[ [
{ a: $(expanse_var_2), $(expanse_key): $|2**3| }, { a: $(expanse_var_2), $(expanse_key): <|2**3|> },
{ {
'$|"bla".replace("a", "o")|': '<|"bla".replace("a", "o")|>':
[$|$(expanse_var)*$(expanse_var_2)|, 25], [<|$(expanse_var)*$(expanse_var_2)|>, 25],
}, },
] ]
@@ -61,4 +61,4 @@
name: Check complex variables expansion is correct (PASS) name: Check complex variables expansion is correct (PASS)
key: $(test)_PASS key: $(test)_PASS
values: values:
- '$| $(expanse_object) == [{"a": 6, "b": 8}, {"blo": [18, 25]}] |' - '<| $(expanse_object) == [{"a": 6, "b": 8}, {"blo": [18, 25]}] |>'

View File

@@ -13,7 +13,7 @@
- group: - group:
name: jsonrpc tests name: jsonrpc tests
condition: $| '/jrpces' in r'''$(cn_json rpc echo server)''' | condition: <| '/jrpces' in r'''$(cn_json rpc echo server)''' |>
steps: steps:
- console: - console:
name: Start the json rpc echo server name: Start the json rpc echo server

View File

@@ -12,7 +12,7 @@
name: Let it be name: Let it be
values: values:
it: $(loop_param) it: $(loop_param)
be: $| $(loop_param) == $(it) | be: <| $(loop_param) == $(it) |>
- loop: - loop:
name: Cycle iterating on list name: Cycle iterating on list
@@ -30,7 +30,7 @@
name: Let it be name: Let it be
values: values:
- it: $(loop_param) - it: $(loop_param)
- be: $| $(loop_param) == $(it) | - be: <| $(loop_param) == $(it) |>
- let: - let:
name: Get time name: Get time
@@ -44,7 +44,7 @@
name: Get parameter file value name: Get parameter file value
key: $(test)_PASS key: $(test)_PASS
values: values:
- test_overwrite_me: $| $(overwrite_me) == True | - test_overwrite_me: <| $(overwrite_me) == True |>
- py_func: - py_func:
name: Check global dic pass name: Check global dic pass
@@ -84,10 +84,10 @@
name: Evaluate Overwriting parameter file value name: Evaluate Overwriting parameter file value
key: $(test)_PASS key: $(test)_PASS
values: values:
- test_overwrite_me: $| "$(overwrite_me)" == True | - test_overwrite_me: <| "$(overwrite_me)" == True |>
- check: - check:
name: Check Overwriting parameter file value name: Check Overwriting parameter file value
key: $(test)_PASS key: $(test)_PASS
values: values:
- $(test_overwrite_me) == False - <| $(test_overwrite_me) == False |>

View File

@@ -13,14 +13,14 @@ main:
- let: - let:
name: Set test variables for Linux name: Set test variables for Linux
condition: $| "$(os)" == "Linux" | condition: <| "$(os)" == "Linux" |>
values: values:
- terminal_prompt: $(linux_prompt) - terminal_prompt: $(linux_prompt)
- psep: "/" - psep: "/"
- let: - let:
name: Set test variables for Windows name: Set test variables for Windows
condition: $| "$(os)" == "Windows" | condition: <| "$(os)" == "Windows" |>
values: values:
- terminal_prompt: $(windows_prompt) - terminal_prompt: $(windows_prompt)
- psep: "\\" - psep: "\\"

View File

@@ -1,5 +1,5 @@
# All sub directory in items are evaluated as a list # 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 # - common
# - check # - check
# - console # - console