aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2018-01-20 22:58:48 +0700
committerSergey M․ <dstftw@gmail.com>2018-01-20 23:00:09 +0700
commitc707b1d828c74f1ec8ffbfda7c910aec0c89a6e2 (patch)
tree2bfc9c155fb816898f83a5483bc6cb4d9febf5a2 /test
parentc384d537f882efab10a78a56ce6dcb0a30f54b47 (diff)
[test_utils] Add tests for malformed JSON handling in js_to_json
Diffstat (limited to 'test')
-rw-r--r--test/test_utils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index 6ef498a66..fdf6031f7 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -891,6 +891,10 @@ class TestUtil(unittest.TestCase):
on = js_to_json('{42:4.2e1}')
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):
self.assertEqual(extract_attributes('<e x="y">'), {'x': 'y'})
self.assertEqual(extract_attributes("<e x='y'>"), {'x': 'y'})