summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_json/test_decode.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-01-26 11:16:30 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-01-26 11:16:30 (GMT)
commit47efb4a5dc9cdf3f59362beb9a04c5c6bdd09f81 (patch)
treeb3e5115125360618a02a9615a643cbebe4aa7e75 /Lib/test/test_json/test_decode.py
parent4e5d9eac2ca03debecbb9c6ed873303d04ead06a (diff)
downloadcpython-47efb4a5dc9cdf3f59362beb9a04c5c6bdd09f81.zip
cpython-47efb4a5dc9cdf3f59362beb9a04c5c6bdd09f81.tar.gz
cpython-47efb4a5dc9cdf3f59362beb9a04c5c6bdd09f81.tar.bz2
Issue #19361: JSON decoder now raises JSONDecodeError instead of ValueError.
Diffstat (limited to 'Lib/test/test_json/test_decode.py')
-rw-r--r--Lib/test/test_json/test_decode.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_json/test_decode.py b/Lib/test/test_json/test_decode.py
index 591b2e2..cc83b45 100644
--- a/Lib/test/test_json/test_decode.py
+++ b/Lib/test/test_json/test_decode.py
@@ -63,12 +63,12 @@ class TestDecode:
def test_extra_data(self):
s = '[1, 2, 3]5'
msg = 'Extra data'
- self.assertRaisesRegex(ValueError, msg, self.loads, s)
+ self.assertRaisesRegex(self.JSONDecodeError, msg, self.loads, s)
def test_invalid_escape(self):
s = '["abc\\y"]'
msg = 'escape'
- self.assertRaisesRegex(ValueError, msg, self.loads, s)
+ self.assertRaisesRegex(self.JSONDecodeError, msg, self.loads, s)
def test_invalid_input_type(self):
msg = 'the JSON object must be str'
@@ -80,10 +80,10 @@ class TestDecode:
def test_string_with_utf8_bom(self):
# see #18958
bom_json = "[1,2,3]".encode('utf-8-sig').decode('utf-8')
- with self.assertRaises(ValueError) as cm:
+ with self.assertRaises(self.JSONDecodeError) as cm:
self.loads(bom_json)
self.assertIn('BOM', str(cm.exception))
- with self.assertRaises(ValueError) as cm:
+ with self.assertRaises(self.JSONDecodeError) as cm:
self.json.load(StringIO(bom_json))
self.assertIn('BOM', str(cm.exception))
# make sure that the BOM is not detected in the middle of a string