Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/simplejson/simplejson/tests/test_separators.py

Issue 159607: Extension docs build script, gyp target and PRESUBMIT.PY check (Closed)
Patch Set: remove build step on mac Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 import textwrap
2 from unittest import TestCase
3
4 import simplejson as json
5
6
7 class TestSeparators(TestCase):
8 def test_separators(self):
9 h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth ',
10 {'nifty': 87}, {'field': 'yes', 'morefield': False} ]
11
12 expect = textwrap.dedent("""\
13 [
14 [
15 "blorpie"
16 ] ,
17 [
18 "whoops"
19 ] ,
20 [] ,
21 "d-shtaeou" ,
22 "d-nthiouh" ,
23 "i-vhbjkhnth" ,
24 {
25 "nifty" : 87
26 } ,
27 {
28 "field" : "yes" ,
29 "morefield" : false
30 }
31 ]""")
32
33
34 d1 = json.dumps(h)
35 d2 = json.dumps(h, indent=2, sort_keys=True, separators=(' ,', ' : '))
36
37 h1 = json.loads(d1)
38 h2 = json.loads(d2)
39
40 self.assertEquals(h1, h)
41 self.assertEquals(h2, h)
42 self.assertEquals(d2, expect)
OLDNEW
« no previous file with comments | « third_party/simplejson/simplejson/tests/test_scanstring.py ('k') | third_party/simplejson/simplejson/tests/test_unicode.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698