[utils] Correct octal/hexadecimal number detection in js_to_json

This commit is contained in:
Yen Chi Hsuan 2016-08-19 20:37:17 +08:00
parent 9e5751b9fe
commit e4659b4547
No known key found for this signature in database
GPG key ID: 3FDDD575826C5C30
3 changed files with 12 additions and 3 deletions

View file

@ -712,6 +712,9 @@ class TestUtil(unittest.TestCase):
inp = '''{"foo":101}'''
self.assertEqual(js_to_json(inp), '''{"foo":101}''')
inp = '''{"duration": "00:01:07"}'''
self.assertEqual(js_to_json(inp), '''{"duration": "00:01:07"}''')
def test_js_to_json_edgecases(self):
on = js_to_json("{abc_def:'1\\'\\\\2\\\\\\'3\"4'}")
self.assertEqual(json.loads(on), {"abc_def": "1'\\2\\'3\"4"})