diff options
author | Sergey M․ <dstftw@gmail.com> | 2020-11-17 01:30:43 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2020-11-17 01:30:43 +0700 |
commit | fe07e788bf7718d429d6fc7e4bcb0c761ffd2cfc (patch) | |
tree | 1830df3e5dc69983c293384a62403a2d31b9f696 /test | |
parent | 6d3bdcf2177ce75f8f95731186a4794412b9776d (diff) |
[utils] Skip ! prefixed code in js_to_json
Diffstat (limited to 'test')
-rw-r--r-- | test/test_utils.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index c2d1e4fb1..925a21d34 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -937,6 +937,28 @@ class TestUtil(unittest.TestCase): self.assertEqual(d['x'], 1) self.assertEqual(d['y'], 'a') + # Just drop ! prefix for now though this results in a wrong value + on = js_to_json('''{ + a: !0, + b: !1, + c: !!0, + d: !!42.42, + e: !!![], + f: !"abc", + g: !"", + !42: 42 + }''') + self.assertEqual(json.loads(on), { + 'a': 0, + 'b': 1, + 'c': 0, + 'd': 42.42, + 'e': [], + 'f': "abc", + 'g': "", + '42': 42 + }) + on = js_to_json('["abc", "def",]') self.assertEqual(json.loads(on), ['abc', 'def']) |