mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-31 13:29:35 +08:00
bugfix: substitute_variables_with_mapping, handle when value is None, bool, empty string
This commit is contained in:
@@ -192,7 +192,16 @@ def substitute_variables_with_mapping(content, mapping):
|
||||
}
|
||||
}
|
||||
"""
|
||||
if isinstance(content, (list, tuple)):
|
||||
if isinstance(content, bool):
|
||||
return content
|
||||
|
||||
if isinstance(content, (int, utils.long_type, float, complex)):
|
||||
return content
|
||||
|
||||
if not content:
|
||||
return content
|
||||
|
||||
if isinstance(content, (list, set, tuple)):
|
||||
return [
|
||||
substitute_variables_with_mapping(item, mapping)
|
||||
for item in content
|
||||
@@ -207,9 +216,6 @@ def substitute_variables_with_mapping(content, mapping):
|
||||
|
||||
return substituted_data
|
||||
|
||||
if isinstance(content, (int, utils.long_type, float, complex)):
|
||||
return content
|
||||
|
||||
# content is in string format here
|
||||
for var, value in mapping.items():
|
||||
if content == var:
|
||||
|
||||
Reference in New Issue
Block a user