Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(61006)

Delta Between Two Patch Sets: Lib/test/test_json/test_decode.py

Issue 19361: Specialize exceptions thrown by JSON parser
Left Patch Set: Created 5 years ago
Right Patch Set: Created 4 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/test/test_json/__init__.py ('k') | Lib/test/test_json/test_fail.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 import decimal 1 import decimal
2 from io import StringIO, BytesIO 2 from io import StringIO, BytesIO
3 from collections import OrderedDict 3 from collections import OrderedDict
4 from test.test_json import PyTest, CTest 4 from test.test_json import PyTest, CTest
5 5
6 6
7 class TestDecode: 7 class TestDecode:
8 def test_decimal(self): 8 def test_decimal(self):
9 rval = self.loads('1.1', parse_float=decimal.Decimal) 9 rval = self.loads('1.1', parse_float=decimal.Decimal)
10 self.assertTrue(isinstance(rval, decimal.Decimal)) 10 self.assertTrue(isinstance(rval, decimal.Decimal))
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 bom_in_str = '"{}"'.format(''.encode('utf-8-sig').decode('utf-8')) 90 bom_in_str = '"{}"'.format(''.encode('utf-8-sig').decode('utf-8'))
91 self.assertEqual(self.loads(bom_in_str), '\ufeff') 91 self.assertEqual(self.loads(bom_in_str), '\ufeff')
92 self.assertEqual(self.json.load(StringIO(bom_in_str)), '\ufeff') 92 self.assertEqual(self.json.load(StringIO(bom_in_str)), '\ufeff')
93 93
94 def test_negative_index(self): 94 def test_negative_index(self):
95 d = self.json.JSONDecoder() 95 d = self.json.JSONDecoder()
96 self.assertRaises(ValueError, d.raw_decode, 'a'*42, -50000) 96 self.assertRaises(ValueError, d.raw_decode, 'a'*42, -50000)
97 97
98 class TestPyDecode(TestDecode, PyTest): pass 98 class TestPyDecode(TestDecode, PyTest): pass
99 class TestCDecode(TestDecode, CTest): pass 99 class TestCDecode(TestDecode, CTest): pass
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+