summaryrefslogtreecommitdiffstats
path: root/Lib/test/json_tests/test_speedups.py
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-11-30 03:03:30 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-11-30 03:03:30 (GMT)
commitff27ee0b400030419cfd3c9966f275bfbcb569f8 (patch)
treec2e45325768bd5256432667c387f304d549493e6 /Lib/test/json_tests/test_speedups.py
parent69b34bfe9c3e5da1d7336a607ab56f1c3a178dca (diff)
downloadcpython-ff27ee0b400030419cfd3c9966f275bfbcb569f8.zip
cpython-ff27ee0b400030419cfd3c9966f275bfbcb569f8.tar.gz
cpython-ff27ee0b400030419cfd3c9966f275bfbcb569f8.tar.bz2
Issue #10572: Moved json tests to Lib/test/json_tests.
Approved by Raymond Hettinger.
Diffstat (limited to 'Lib/test/json_tests/test_speedups.py')
-rw-r--r--Lib/test/json_tests/test_speedups.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/json_tests/test_speedups.py b/Lib/test/json_tests/test_speedups.py
new file mode 100644
index 0000000..2718409
--- /dev/null
+++ b/Lib/test/json_tests/test_speedups.py
@@ -0,0 +1,23 @@
+from unittest import TestCase
+
+from json import decoder, encoder, scanner
+
+class TestSpeedups(TestCase):
+ def test_scanstring(self):
+ self.assertEqual(decoder.scanstring.__module__, "_json")
+ self.assertTrue(decoder.scanstring is decoder.c_scanstring)
+
+ def test_encode_basestring_ascii(self):
+ self.assertEqual(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)