ยปCore Development>Code coverage>Lib/test/test_json/test_pass1.py

Python code coverage for Lib/test/test_json/test_pass1.py

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