summaryrefslogtreecommitdiffstats
path: root/Lib/json/tests
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/json/tests')
-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 94e01e6..9768edf 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)