Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
promans718 committed Oct 4, 2024
1 parent 2977618 commit 7892e31
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions toolium/test/utils/test_dataset_map_param_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 10 additions & 9 deletions toolium/utils/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 7892e31

Please sign in to comment.