MCPcopy
hub / github.com/httprunner/httprunner / parse_string_value

Function parse_string_value

httprunner/parser.py:22–35  ·  view source on GitHub ↗

parse string to number if possible e.g. "123" => 123 "12.2" => 12.3 "abc" => "abc" "$var" => "$var"

(str_value: Text)

Source from the content-addressed store, hash-verified

20
21
22def parse_string_value(str_value: Text) -> Any:
23 """parse string to number if possible
24 e.g. "123" => 123
25 "12.2" => 12.3
26 "abc" => "abc"
27 "$var" => "$var"
28 """
29 try:
30 return ast.literal_eval(str_value)
31 except ValueError:
32 return str_value
33 except SyntaxError:
34 # e.g. $var, ${func}
35 return str_value
36
37
38def build_url(base_url, step_url):

Callers 2

validateMethod · 0.90
parse_function_paramsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected