utils.javascript: Handle bools in _convert_js_arg
This commit is contained in:
parent
b596c4da27
commit
30029a8259
@ -52,6 +52,8 @@ def _convert_js_arg(arg):
|
||||
return 'undefined'
|
||||
elif isinstance(arg, str):
|
||||
return '"{}"'.format(string_escape(arg))
|
||||
elif isinstance(arg, bool):
|
||||
return str(arg).lower()
|
||||
elif isinstance(arg, (int, float)):
|
||||
return str(arg)
|
||||
else:
|
||||
|
@ -127,8 +127,10 @@ class TestStringEscape:
|
||||
('foo\\bar', r'"foo\\bar"'),
|
||||
(42, '42'),
|
||||
(23.42, '23.42'),
|
||||
(False, 'false'),
|
||||
(None, 'undefined'),
|
||||
(object(), TypeError),
|
||||
(True, 'true'),
|
||||
])
|
||||
def test_convert_js_arg(arg, expected):
|
||||
if expected is TypeError:
|
||||
|
Loading…
Reference in New Issue
Block a user