summaryrefslogtreecommitdiffstats
path: root/Lib/json/tests/test_decode.py
diff options
context:
space:
mode:
authorEzio Melotti <none@none>2011-04-13 02:37:29 (GMT)
committerEzio Melotti <none@none>2011-04-13 02:37:29 (GMT)
commit2b96f0987ac966ef9ac037610da6b5b7e3996af6 (patch)
tree968a3101cc04d5f8909df6f75d9dd7623c46f904 /Lib/json/tests/test_decode.py
parent179816df59744313693d21525046d1d38af9119c (diff)
downloadcpython-2b96f0987ac966ef9ac037610da6b5b7e3996af6.zip
cpython-2b96f0987ac966ef9ac037610da6b5b7e3996af6.tar.gz
cpython-2b96f0987ac966ef9ac037610da6b5b7e3996af6.tar.bz2
#9233: Fix json.loads({}) to return a dict (instead of a list), when _json is not available.
Diffstat (limited to 'Lib/json/tests/test_decode.py')
-rw-r--r--Lib/json/tests/test_decode.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/json/tests/test_decode.py b/Lib/json/tests/test_decode.py
index 6afafe6..95088b4 100644
--- a/Lib/json/tests/test_decode.py
+++ b/Lib/json/tests/test_decode.py
@@ -23,6 +23,11 @@ class TestDecode(TestCase):
rval = json.loads('{ "key" : "value" , "k":"v" }')
self.assertEqual(rval, {"key":"value", "k":"v"})
+ def test_empty_objects(self):
+ self.assertEqual(json.loads('{}'), {})
+ self.assertEqual(json.loads('[]'), [])
+ self.assertEqual(json.loads('""'), "")
+
def test_object_pairs_hook(self):
s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
p = [("xkd", 1), ("kcw", 2), ("art", 3), ("hxm", 4),