Handle float in _convert_js_arg
This fixes 'gg' with QtWebEngine.
This commit is contained in:
parent
96087bd554
commit
627f743c26
@ -55,7 +55,7 @@ def _convert_js_arg(arg):
|
|||||||
return 'undefined'
|
return 'undefined'
|
||||||
elif isinstance(arg, str):
|
elif isinstance(arg, str):
|
||||||
return '"{}"'.format(string_escape(arg))
|
return '"{}"'.format(string_escape(arg))
|
||||||
elif isinstance(arg, int):
|
elif isinstance(arg, (int, float)):
|
||||||
return str(arg)
|
return str(arg)
|
||||||
else:
|
else:
|
||||||
raise TypeError("Don't know how to handle {!r} of type {}!".format(
|
raise TypeError("Don't know how to handle {!r} of type {}!".format(
|
||||||
|
@ -126,6 +126,7 @@ class TestStringEscape:
|
|||||||
('foobar', '"foobar"'),
|
('foobar', '"foobar"'),
|
||||||
('foo\\bar', r'"foo\\bar"'),
|
('foo\\bar', r'"foo\\bar"'),
|
||||||
(42, '42'),
|
(42, '42'),
|
||||||
|
(23.42, '23.42'),
|
||||||
(None, 'undefined'),
|
(None, 'undefined'),
|
||||||
(object(), TypeError),
|
(object(), TypeError),
|
||||||
])
|
])
|
||||||
|
Loading…
Reference in New Issue
Block a user