mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-13 20:03:17 +00:00
[test_utils] Add tests for malformed JSON handling in js_to_json
This commit is contained in:
parent
c384d537f8
commit
c707b1d828
|
@ -891,6 +891,10 @@ def test_js_to_json_edgecases(self):
|
||||||
on = js_to_json('{42:4.2e1}')
|
on = js_to_json('{42:4.2e1}')
|
||||||
self.assertEqual(json.loads(on), {'42': 42.0})
|
self.assertEqual(json.loads(on), {'42': 42.0})
|
||||||
|
|
||||||
|
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')
|
||||||
|
|
||||||
def test_extract_attributes(self):
|
def test_extract_attributes(self):
|
||||||
self.assertEqual(extract_attributes('<e x="y">'), {'x': 'y'})
|
self.assertEqual(extract_attributes('<e x="y">'), {'x': 'y'})
|
||||||
self.assertEqual(extract_attributes("<e x='y'>"), {'x': 'y'})
|
self.assertEqual(extract_attributes("<e x='y'>"), {'x': 'y'})
|
||||||
|
|
Loading…
Reference in a new issue