OLD | NEW |
1 from unittest import TestCase | 1 from unittest import TestCase |
2 | 2 |
3 import json | 3 import json |
4 import textwrap | 4 import textwrap |
5 | 5 |
6 class TestIndent(TestCase): | 6 class TestIndent(TestCase): |
7 def test_indent(self): | 7 def test_indent(self): |
8 h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth
', | 8 h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth
', |
9 {'nifty': 87}, {'field': 'yes', 'morefield': False} ] | 9 {'nifty': 87}, {'field': 'yes', 'morefield': False} ] |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 | 32 |
33 d1 = json.dumps(h) | 33 d1 = json.dumps(h) |
34 d2 = json.dumps(h, indent=2, sort_keys=True, separators=(',', ': ')) | 34 d2 = json.dumps(h, indent=2, sort_keys=True, separators=(',', ': ')) |
35 d3 = json.dumps(h, indent='\t', sort_keys=True, separators=(',', ': ')) | 35 d3 = json.dumps(h, indent='\t', sort_keys=True, separators=(',', ': ')) |
36 | 36 |
37 h1 = json.loads(d1) | 37 h1 = json.loads(d1) |
38 h2 = json.loads(d2) | 38 h2 = json.loads(d2) |
39 h3 = json.loads(d3) | 39 h3 = json.loads(d3) |
40 | 40 |
41 self.assertEquals(h1, h) | 41 self.assertEqual(h1, h) |
42 self.assertEquals(h2, h) | 42 self.assertEqual(h2, h) |
43 self.assertEquals(h3, h) | 43 self.assertEqual(h3, h) |
44 self.assertEquals(d2, expect.expandtabs(2)) | 44 self.assertEqual(d2, expect.expandtabs(2)) |
45 self.assertEquals(d3, expect) | 45 self.assertEqual(d3, expect) |
OLD | NEW |