summaryrefslogtreecommitdiffstats
path: root/Lib/json
diff options
context:
space:
mode:
authorDoug Hellmann <doug.hellmann@gmail.com>2010-07-21 12:36:33 (GMT)
committerDoug Hellmann <doug.hellmann@gmail.com>2010-07-21 12:36:33 (GMT)
commitf31db93fc1239a6d9c2fe61c73ba9303005208e1 (patch)
tree10da07135e4a337be18c79c3883f69ac95e97e77 /Lib/json
parent8c4fa1159173b3c8dc59f4cf1e73419eb2128961 (diff)
downloadcpython-f31db93fc1239a6d9c2fe61c73ba9303005208e1.zip
cpython-f31db93fc1239a6d9c2fe61c73ba9303005208e1.tar.gz
cpython-f31db93fc1239a6d9c2fe61c73ba9303005208e1.tar.bz2
Apply patch from Ray Allen for issue 9296
Diffstat (limited to 'Lib/json')
-rw-r--r--Lib/json/tests/test_fail.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/json/tests/test_fail.py b/Lib/json/tests/test_fail.py
index 72df517..dd9ec41 100644
--- a/Lib/json/tests/test_fail.py
+++ b/Lib/json/tests/test_fail.py
@@ -74,3 +74,12 @@ class TestFail(TestCase):
pass
else:
self.fail("Expected failure for fail{0}.json: {1!r}".format(idx, doc))
+
+ def test_non_string_keys_dict(self):
+ data = {'a' : 1, (1, 2) : 2}
+
+ #This is for c encoder
+ self.assertRaises(TypeError, json.dumps, data)
+
+ #This is for python encoder
+ self.assertRaises(TypeError, json.dumps, data, indent=True)