Package lepl :: Package apps :: Package _test :: Module json
[hide private]
[frames] | no frames]

Source Code for Module lepl.apps._test.json

 1   
 2  from lepl.apps.json import Simple 
 3  from lepl._test.base import BaseTest 
 4   
 5   
6 -class JsonTest(BaseTest):
7
8 - def test_dict(self):
9 self.assert_direct('{"a": 123, "b": "somewhere"}', Simple(), 10 [[{'a': 123.0, 'b': 'somewhere'}]])
11
12 - def test_escape(self):
13 self.assert_direct('"a\\u0020b"', Simple(), 14 [['a b']]) 15 self.assert_direct('"a\\nb"', Simple(), 16 [['a\nb']])
17
18 - def test_array(self):
19 self.assert_direct('[1,2,[3,4],[[5], 6]]', Simple(), 20 [[[1.0,2.0,[3.0,4.0],[[5.0],6.0]]]])
21
22 - def test_object(self):
23 self.assert_direct('{"a": 1}', Simple(), 24 [[{"a": 1.0}]]) 25 self.assert_direct('{"a": 1, "b": [2,3]}', Simple(), 26 [[{"a": 1.0, "b": [2.0, 3.0]}]])
27
28 - def test_spaces(self):
29 self.assert_direct('{"a": 1, "b":"c","d" : [ 2, 3.]}', Simple(), 30 [[{'a': 1.0, 'b': 'c', 'd': [2.0, 3.0]}]])
31