1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-06-30 19:12:53 -05:00

[utils] js_to_json: Make function less fatal (#12715)

Authored by: seproDev
This commit is contained in:
sepro
2025-03-24 22:28:47 +01:00
committed by GitHub
parent b7fbb5a0a1
commit 9491b44032
2 changed files with 3 additions and 1 deletions

View File

@ -1260,6 +1260,7 @@ class TestUtil(unittest.TestCase):
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')
self.assertEqual(js_to_json('{a: `${e("")}`}'), '{"a": "\\"e\\"(\\"\\")"}')
def test_js_to_json_template_literal(self):
self.assertEqual(js_to_json('`Hello ${name}`', {'name': '"world"'}), '"Hello world"')