~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_pass1.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
 
 
3
 
import simplejson as json
4
 
 
5
 
# from http://json.org/JSON_checker/test/pass1.json
6
 
JSON = r'''
7
 
[
8
 
    "JSON Test Pattern pass1",
9
 
    {"object with 1 member":["array with 1 element"]},
10
 
    {},
11
 
    [],
12
 
    -42,
13
 
    true,
14
 
    false,
15
 
    null,
16
 
    {
17
 
        "integer": 1234567890,
18
 
        "real": -9876.543210,
19
 
        "e": 0.123456789e-12,
20
 
        "E": 1.234567890E+34,
21
 
        "":  23456789012E666,
22
 
        "zero": 0,
23
 
        "one": 1,
24
 
        "space": " ",
25
 
        "quote": "\"",
26
 
        "backslash": "\\",
27
 
        "controls": "\b\f\n\r\t",
28
 
        "slash": "/ & \/",
29
 
        "alpha": "abcdefghijklmnopqrstuvwyz",
30
 
        "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
31
 
        "digit": "0123456789",
32
 
        "special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
33
 
        "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
34
 
        "true": true,
35
 
        "false": false,
36
 
        "null": null,
37
 
        "array":[  ],
38
 
        "object":{  },
39
 
        "address": "50 St. James Street",
40
 
        "url": "http://www.JSON.org/",
41
 
        "comment": "// /* <!-- --",
42
 
        "# -- --> */": " ",
43
 
        " s p a c e d " :[1,2 , 3
44
 
 
45
 
,
46
 
 
47
 
4 , 5        ,          6           ,7        ],
48
 
        "compact": [1,2,3,4,5,6,7],
49
 
        "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",
50
 
        "quotes": "&#34; \u0022 %22 0x22 034 &#x22;",
51
 
        "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
52
 
: "A key can be any string"
53
 
    },
54
 
    0.5 ,98.6
55
 
,
56
 
99.44
57
 
,
58
 
 
59
 
1066
60
 
 
61
 
 
62
 
,"rosebud"]
63
 
'''
64
 
 
65
 
class TestPass1(TestCase):
66
 
    def test_parse(self):
67
 
        # test in/out equivalence and parsing
68
 
        res = json.loads(JSON)
69
 
        out = json.dumps(res)
70
 
        self.assertEquals(res, json.loads(out))
71
 
        try:
72
 
            json.dumps(res, allow_nan=False)
73
 
        except ValueError:
74
 
            pass
75
 
        else:
76
 
            self.fail("23456789012E666 should be out of range")