From 7892e3108c4936e1074da9604aec5608c88bcbd1 Mon Sep 17 00:00:00 2001 From: Patricia Roman Sanchez Date: Fri, 4 Oct 2024 13:54:36 +0200 Subject: [PATCH] Fix linter issues --- .../utils/test_dataset_map_param_context.py | 1 + toolium/utils/dataset.py | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/toolium/test/utils/test_dataset_map_param_context.py b/toolium/test/utils/test_dataset_map_param_context.py index 56fe259d..449056e3 100644 --- a/toolium/test/utils/test_dataset_map_param_context.py +++ b/toolium/test/utils/test_dataset_map_param_context.py @@ -428,6 +428,7 @@ class Context(object): dataset.behave_context = context assert map_param("[CONTEXT:list.cmsScrollableActions.1.id]") == 'ask-for-qa' + def test_a_context_param_list_correct_negative_index(): """ Verification of a list with a correct negative index (In bounds) as CONTEXT diff --git a/toolium/utils/dataset.py b/toolium/utils/dataset.py index df5e6d50..a43c8a6c 100644 --- a/toolium/utils/dataset.py +++ b/toolium/utils/dataset.py @@ -288,30 +288,31 @@ def _update_param_transform_string(type_mapping_match_group): """ Transform param value according to the specified prefix. Available transformations: STR, UPPER, LOWER, REPLACE, DATE, TITLE - + :param type_mapping_match_group: match group :return: return the string with the replaced param """ if type_mapping_match_group.group(1) == 'STR': replace_param = type_mapping_match_group.group(2) - elif type_mapping_match_group.group(1) == 'UPPER': + elif type_mapping_match_group.group(1) == 'UPPER': replace_param = type_mapping_match_group.group(2).upper() - elif type_mapping_match_group.group(1) == 'LOWER': + elif type_mapping_match_group.group(1) == 'LOWER': replace_param = type_mapping_match_group.group(2).lower() - elif type_mapping_match_group.group(1) == 'REPLACE': + elif type_mapping_match_group.group(1) == 'REPLACE': params_to_replace = type_mapping_match_group.group(2).split('::') replace_param = params_to_replace[2] if len(params_to_replace) > 2 else '' param_to_replace = params_to_replace[1] if params_to_replace[1] != '\\n' else '\n' param_to_replace = params_to_replace[1] if params_to_replace[1] != '\\r' else '\r' replace_param = params_to_replace[0].replace(param_to_replace, replace_param)\ .replace(' ', ' ').replace(' ', ' ') - elif type_mapping_match_group.group(1) == 'DATE': + elif type_mapping_match_group.group(1) == 'DATE': params_to_replace = type_mapping_match_group.group(2).split('::') date_actual_format = '%Y/%m/%d %H:%M:%S' - replace_param = _format_date_spanish(params_to_replace[0], params_to_replace[1], date_actual_format, \ - capitalize=False) - elif type_mapping_match_group.group(1) == 'TITLE': - replace_param = "".join(map(min, zip(type_mapping_match_group.group(2), type_mapping_match_group.group(2).title()))) + replace_param = _format_date_spanish(params_to_replace[0], params_to_replace[1], date_actual_format, + capitalize=False) + elif type_mapping_match_group.group(1) == 'TITLE': + replace_param = "".join(map(min, zip(type_mapping_match_group.group(2), + type_mapping_match_group.group(2).title()))) return replace_param