summaryrefslogtreecommitdiffstats
path: root/Lib/json
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-12-08 16:00:03 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-12-08 16:00:03 (GMT)
commit4fad6bdde98e182d95eb2033eb8dd78344556727 (patch)
treef98513851ca9f94f69186c169ab1ed552879145e /Lib/json
parent60a32c8c0b2e58fa96d9d6417526446b922d79e3 (diff)
downloadcpython-4fad6bdde98e182d95eb2033eb8dd78344556727.zip
cpython-4fad6bdde98e182d95eb2033eb8dd78344556727.tar.gz
cpython-4fad6bdde98e182d95eb2033eb8dd78344556727.tar.bz2
Merged revisions 76710 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r76710 | antoine.pitrou | 2009-12-08 16:57:31 +0100 (mar., 08 déc. 2009) | 10 lines Merged revisions 76708 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r76708 | antoine.pitrou | 2009-12-08 16:40:51 +0100 (mar., 08 déc. 2009) | 4 lines Issue #6986: Fix crash in the JSON C accelerator when called with the wrong parameter types. Patch by Victor Stinner. ........ ................
Diffstat (limited to 'Lib/json')
-rw-r--r--Lib/json/tests/test_speedups.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/Lib/json/tests/test_speedups.py b/Lib/json/tests/test_speedups.py
index 3a84ddf..29e40ac 100644
--- a/Lib/json/tests/test_speedups.py
+++ b/Lib/json/tests/test_speedups.py
@@ -1,8 +1,7 @@
import decimal
from unittest import TestCase
-from json import decoder
-from json import encoder
+from json import decoder, encoder, scanner
class TestSpeedups(TestCase):
def test_scanstring(self):
@@ -13,3 +12,13 @@ class TestSpeedups(TestCase):
self.assertEquals(encoder.encode_basestring_ascii.__module__, "_json")
self.assertTrue(encoder.encode_basestring_ascii is
encoder.c_encode_basestring_ascii)
+
+class TestDecode(TestCase):
+ def test_make_scanner(self):
+ self.assertRaises(AttributeError, scanner.c_make_scanner, 1)
+
+ def test_make_encoder(self):
+ self.assertRaises(TypeError, encoder.c_make_encoder,
+ (True, False),
+ b"\xCD\x7D\x3D\x4E\x12\x4C\xF9\x79\xD7\x52\xBA\x82\xF2\x27\x4A\x7D\xA0\xCA\x75",
+ None)