diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-10-16 21:09:28 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-10-16 21:09:28 (GMT) |
commit | 595e3cbb3db46124abcbf605bbe8d5784a69213e (patch) | |
tree | 41cd219c268744ce348f24885c3801cbabc86c41 /Lib/json | |
parent | eaede315d1f9e18c6fcad30d3b13f8b2a7242e37 (diff) | |
download | cpython-595e3cbb3db46124abcbf605bbe8d5784a69213e.zip cpython-595e3cbb3db46124abcbf605bbe8d5784a69213e.tar.gz cpython-595e3cbb3db46124abcbf605bbe8d5784a69213e.tar.bz2 |
check for error conditions in _json #3623
Diffstat (limited to 'Lib/json')
-rw-r--r-- | Lib/json/tests/test_scanstring.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/json/tests/test_scanstring.py b/Lib/json/tests/test_scanstring.py index 87051bb..6b600db 100644 --- a/Lib/json/tests/test_scanstring.py +++ b/Lib/json/tests/test_scanstring.py @@ -2,6 +2,7 @@ import sys import decimal from unittest import TestCase +import json import json.decoder class TestScanString(TestCase): @@ -100,3 +101,9 @@ class TestScanString(TestCase): self.assertEquals( scanstring('["Bad value", truth]', 2, None, True), (u'Bad value', 12)) + + def test_issue3623(self): + self.assertRaises(ValueError, json.decoder.scanstring, b"xxx", 1, + "xxx") + self.assertRaises(UnicodeDecodeError, + json.encoder.encode_basestring_ascii, b"xx\xff") |