aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_utils.py
diff options
context:
space:
mode:
authorTom-Oliver Heidel <github@tom-oliver.eu>2020-11-30 02:51:41 +0100
committerGitHub <noreply@github.com>2020-11-30 02:51:41 +0100
commitb662fc8d2033c615ffbdd3b51123b446c03255e8 (patch)
tree3d32dc25a663f4e61fc28860acda67c7a425cb7a /test/test_utils.py
parent8924ddc3eec4c03c6776673d0d5e823dc5445549 (diff)
parent929576bb9e4aa31f0516f1437d2ae762afdd9f2c (diff)
downloadhypervideo-pre-b662fc8d2033c615ffbdd3b51123b446c03255e8.tar.lz
hypervideo-pre-b662fc8d2033c615ffbdd3b51123b446c03255e8.tar.xz
hypervideo-pre-b662fc8d2033c615ffbdd3b51123b446c03255e8.zip
Merge branch 'master' into gedi
Diffstat (limited to 'test/test_utils.py')
-rw-r--r--test/test_utils.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index 95231200b..16ad40831 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'])
@@ -994,6 +1016,12 @@ class TestUtil(unittest.TestCase):
on = js_to_json('{42:4.2e1}')
self.assertEqual(json.loads(on), {'42': 42.0})
+ on = js_to_json('{ "0x40": "0x40" }')
+ self.assertEqual(json.loads(on), {'0x40': '0x40'})
+
+ on = js_to_json('{ "040": "040" }')
+ self.assertEqual(json.loads(on), {'040': '040'})
+
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')