diff options
author | Simon Sawicki <37424085+Grub4K@users.noreply.github.com> | 2022-10-12 22:22:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-13 01:52:17 +0530 |
commit | a71b812f53a5f678e4c9467858e721dcd4953a16 (patch) | |
tree | 32dac1c7d04e1929abd8d7c637d43aab5db8f27f /test/test_utils.py | |
parent | c6989aa3ae5d79137cf6e4228220ad620519bcbd (diff) | |
download | hypervideo-pre-a71b812f53a5f678e4c9467858e721dcd4953a16.tar.lz hypervideo-pre-a71b812f53a5f678e4c9467858e721dcd4953a16.tar.xz hypervideo-pre-a71b812f53a5f678e4c9467858e721dcd4953a16.zip |
[utils] `js_to_json`: Improve escape handling (#5217)
Authored by: Grub4K
Diffstat (limited to 'test/test_utils.py')
-rw-r--r-- | test/test_utils.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index df23f1f47..49ab3796b 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -1100,6 +1100,12 @@ class TestUtil(unittest.TestCase): on = js_to_json('[1,//{},\n2]') self.assertEqual(json.loads(on), [1, 2]) + on = js_to_json(R'"\^\$\#"') + self.assertEqual(json.loads(on), R'^$#', msg='Unnecessary escapes should be stripped') + + on = js_to_json('\'"\\""\'') + self.assertEqual(json.loads(on), '"""', msg='Unnecessary quote escape should be escaped') + def test_js_to_json_malformed(self): self.assertEqual(js_to_json('42a1'), '42"a1"') self.assertEqual(js_to_json('42a-1'), '42"a"-1') |