~ubuntu-branches/ubuntu/quantal/enigmail/quantal-security

« back to all changes in this revision

Viewing changes to python/simplejson-2.1.1/simplejson/tests/test_separators.py

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-09-13 16:02:15 UTC
  • mfrom: (0.12.16)
  • Revision ID: package-import@ubuntu.com-20130913160215-u3g8nmwa0pdwagwc
Tags: 2:1.5.2-0ubuntu0.12.10.1
* New upstream release v1.5.2 for Thunderbird 24

* Build enigmail using a stripped down Thunderbird 17 build system, as it's
  now quite difficult to build the way we were doing previously, with the
  latest Firefox build system
* Add debian/patches/no_libxpcom.patch - Don't link against libxpcom, as it
  doesn't exist anymore (but exists in the build system)
* Add debian/patches/use_sdk.patch - Use the SDK version of xpt.py and
  friends
* Drop debian/patches/ipc-pipe_rename.diff (not needed anymore)
* Drop debian/patches/makefile_depth.diff (not needed anymore)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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='  ', 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)