Skip to content

Commit

Permalink
Fix test issue
Browse files Browse the repository at this point in the history
  • Loading branch information
promans718 committed Oct 8, 2024
1 parent 2f3875c commit 80d2f53
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions toolium/test/utils/test_dataset_map_param_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,10 @@ class Context(object):
}
]
}
dataset.behave_context = context
assert map_param("[CONTEXT:list.cmsScrollableActions.-5.id]")

with pytest.raises(Exception) as excinfo:
map_param("[CONTEXT:list.cmsScrollableActions.-5.id]")
assert "IndexError: list index out of range" == str(excinfo.value)


def test_a_context_param_list_oob_index():
"""
Expand Down
2 changes: 1 addition & 1 deletion toolium/test/utils/test_dataset_replace_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def test_replace_param_dict():

def test_replace_param_dict_json_format():
param = replace_param('[DICT:{"key": "value", "key_2": true}]')
assert param == '{"key": "value", "key_2": true}'
assert param == '{"key": "value", "key_2": True}'
param = replace_param('[DICT:{"key": "value", "key_2": null}]')
assert param == '{"key": "value", "key_2": null}'

Expand Down
4 changes: 2 additions & 2 deletions toolium/utils/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def _replace_param_transform_string(param):
def _update_param_transform_string(type_mapping_match_group):
"""
Transform param value according to the specified prefix.
Available transformations: STR, UPPER, LOWER, REPLACE, TITLE
Available transformations: STR, UPPER, LOWER, REPLACE, TITLE, ROUND
:param type_mapping_match_group: match group
:return: return the string with the replaced param
Expand All @@ -281,7 +281,7 @@ def _update_param_transform_string(type_mapping_match_group):
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 }"
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 80d2f53

Please sign in to comment.