diff options
author | Tom-Oliver Heidel <github@tom-oliver.eu> | 2020-11-30 02:32:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-30 02:32:58 +0100 |
commit | 9693a3477377bedbdc9170575a36ca6b00167ee2 (patch) | |
tree | 6a0262bc708d0af0bf5c8f362f81e978f51a543e /test/test_utils.py | |
parent | 711bd5d362a1a7bec312e23a0f39deff2b3bf8f1 (diff) | |
parent | 6a03f4f2a8c5c9274cce3d6168b501578d332bae (diff) | |
download | hypervideo-pre-9693a3477377bedbdc9170575a36ca6b00167ee2.tar.lz hypervideo-pre-9693a3477377bedbdc9170575a36ca6b00167ee2.tar.xz hypervideo-pre-9693a3477377bedbdc9170575a36ca6b00167ee2.zip |
Merge branch 'master' into master
Diffstat (limited to 'test/test_utils.py')
-rw-r--r-- | test/test_utils.py | 28 |
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') |