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

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

Issue 16510: Using appropriate checks in tests
Left Patch Set: Created 5 years, 9 months ago
Right Patch Set: Created 5 years, 6 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_itertools.py ('k') | Lib/test/test_kqueue.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.assertIsInstance(rval, decimal.Decimal) 10 self.assertIsInstance(rval, decimal.Decimal)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 with self.assertRaises(ValueError) as cm: 86 with self.assertRaises(ValueError) as cm:
87 self.json.load(StringIO(bom_json)) 87 self.json.load(StringIO(bom_json))
88 self.assertIn('BOM', str(cm.exception)) 88 self.assertIn('BOM', str(cm.exception))
89 # make sure that the BOM is not detected in the middle of a string 89 # make sure that the BOM is not detected in the middle of a string
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 class TestPyDecode(TestDecode, PyTest): pass 94 class TestPyDecode(TestDecode, PyTest): pass
95 class TestCDecode(TestDecode, CTest): pass 95 class TestCDecode(TestDecode, CTest): pass
LEFTRIGHT

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