[Python-checkins] cpython (2.7): 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:23 CEST 2012
http://hg.python.org/cpython/rev/b16a5f0d0c87
changeset: 78645:b16a5f0d0c87
branch: 2.7
parent: 78642:377036cb13e9
user: Antoine Pitrou <solipsis at pitrou.net>
date: Sat Aug 18 20:51:05 2012 +0200
summary:
Issue #15615: Add some tests for the json module's handling of invalid input data.
Patch by Kushal Das.
files:
Lib/json/tests/test_decode.py | 9 +++++++++
Misc/ACKS | 1 +
Misc/NEWS | 3 +++
3 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/Lib/json/tests/test_decode.py b/Lib/json/tests/test_decode.py
--- a/Lib/json/tests/test_decode.py
+++ b/Lib/json/tests/test_decode.py
@@ -45,6 +45,15 @@
object_hook=lambda x: None),
OrderedDict(p))
+ 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
@@ -194,6 +194,7 @@
Eric Daniel
Scott David Daniels
Ben Darnell
+Kushal Das
Jonathan Dasteel
John DeGood
Ned Deily
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -335,6 +335,9 @@
Tests
-----
+- Issue #15615: Add some tests for the json module's handling of invalid
+ input data. Patch by Kushal Das.
+
- Issue #15496: Add directory removal helpers for tests on Windows.
Patch by Jeremy Kloth.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list