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 8, 2024
1 parent 6c767a6 commit 2f3875c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion toolium/test/utils/test_dataset_map_param_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ class Context(object):
dataset.behave_context = context
assert map_param("[CONTEXT:list.cmsScrollableActions.-1.id]") == 'ask-for-negative'


def test_a_context_param_list_incorrect_negative_index():
"""
Verification of a list with a incorrect negative index (In bounds) as CONTEXT
Expand All @@ -482,7 +483,7 @@ class Context(object):
}
dataset.behave_context = context
assert map_param("[CONTEXT:list.cmsScrollableActions.-5.id]")


def test_a_context_param_list_oob_index():
"""
Expand Down
10 changes: 5 additions & 5 deletions toolium/utils/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,8 @@ def _replace_param_transform_string(param):

if type_mapping_match_group:
param_transformed = True
if type_mapping_match_group.group(1) in ['DICT', 'LIST', 'INT', 'FLOAT', 'ROUND']:
if '::' in type_mapping_match_group.group() and 'ROUND' in type_mapping_match_group.group():
params_to_replace = type_mapping_match_group.group(2).split('::')
new_param = f"{round(float(params_to_replace[0]), int(params_to_replace[1])):.{int(params_to_replace[1])}f}"
elif type_mapping_match_group.group(1) == 'DICT':
if type_mapping_match_group.group(1) in ['DICT', 'LIST', 'INT', 'FLOAT']:
if type_mapping_match_group.group(1) == 'DICT':
try:
new_param = json.loads(type_mapping_match_group.group(2).strip())
except json.decoder.JSONDecodeError:
Expand Down Expand Up @@ -282,6 +279,9 @@ def _update_param_transform_string(type_mapping_match_group):
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())))
elif type_mapping_match_group.group(1) == 'ROUND':
replace_params = type_mapping_match_group.group(2).split('::')
replace_param = f"{round(float(replace_params[0]), int(replace_params[1])):.{int(replace_params[1])} f }"
return replace_param


Expand Down

0 comments on commit 2f3875c

Please sign in to comment.