[Python-checkins] cpython (merge 3.2 -> default): Issue #15615: Add some tests for the json module's handling of invalid input
antoine.pitrou
python-checkins at python.org
Sat Aug 18 20:54:22 CEST 2012
http://hg.python.org/cpython/rev/01717c3da4fb
changeset: 78644:01717c3da4fb
parent: 78641:336653319112
parent: 78643:cd9a4883dd02
user: Antoine Pitrou <solipsis at pitrou.net>
date: Sat Aug 18 20:48:17 2012 +0200
summary:
Issue #15615: Add some tests for the json module's handling of invalid input data.
Patch by Kushal Das.
files:
Lib/test/json_tests/test_decode.py | 9 +++++++++
Misc/ACKS | 1 +
Misc/NEWS | 5 +++++
3 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/Lib/test/json_tests/test_decode.py b/Lib/test/json_tests/test_decode.py
--- a/Lib/test/json_tests/test_decode.py
+++ b/Lib/test/json_tests/test_decode.py
@@ -54,6 +54,15 @@
self.check_keys_reuse(s, self.loads)
self.check_keys_reuse(s, self.json.decoder.JSONDecoder().decode)
+ def test_extra_data(self):
+ s = '[1, 2, 3]5'
+ msg = 'Extra data'
+ self.assertRaisesRegexp(ValueError, msg, self.loads, s)
+
+ def test_invalid_escape(self):
+ s = '["abc\\y"]'
+ msg = 'escape'
+ self.assertRaisesRegexp(ValueError, msg, self.loads, s)
class TestPyDecode(TestDecode, PyTest): pass
class TestCDecode(TestDecode, CTest): pass
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -238,6 +238,7 @@
Eric Daniel
Scott David Daniels
Ben Darnell
+Kushal Das
Jonathan Dasteel
Pierre-Yves David
Xavier de Gaye
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -52,6 +52,11 @@
- Issue #15630: Add an example for "continue" stmt in the tutorial. Patch by
Daniel Ellis.
+Tests
+-----
+
+- Issue #15615: Add some tests for the json module's handling of invalid
+ input data. Patch by Kushal Das.
What's New in Python 3.3.0 Beta 2?
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list