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

« back to all changes in this revision

Viewing changes to mozilla/python/simplejson-2.1.1/simplejson/tests/test_dump.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
from unittest import TestCase
 
2
from cStringIO import StringIO
 
3
 
 
4
import simplejson as json
 
5
 
 
6
class TestDump(TestCase):
 
7
    def test_dump(self):
 
8
        sio = StringIO()
 
9
        json.dump({}, sio)
 
10
        self.assertEquals(sio.getvalue(), '{}')
 
11
 
 
12
    def test_dumps(self):
 
13
        self.assertEquals(json.dumps({}), '{}')
 
14
 
 
15
    def test_encode_truefalse(self):
 
16
        self.assertEquals(json.dumps(
 
17
                 {True: False, False: True}, sort_keys=True),
 
18
                 '{"false": true, "true": false}')
 
19
        self.assertEquals(json.dumps(
 
20
                {2: 3.0, 4.0: 5L, False: 1, 6L: True, "7": 0}, sort_keys=True),
 
21
                '{"false": 1, "2": 3.0, "4.0": 5, "6": true, "7": 0}')
 
22
 
 
23
    def test_ordered_dict(self):
 
24
        # http://bugs.python.org/issue6105
 
25
        items = [('one', 1), ('two', 2), ('three', 3), ('four', 4), ('five', 5)]
 
26
        s = json.dumps(json.OrderedDict(items))
 
27
        self.assertEqual(s, '{"one": 1, "two": 2, "three": 3, "four": 4, "five": 5}')
 
 
b'\\ No newline at end of file'