示例#1
0
 def testEncodeDecodeComplicated(self):
     d1 = {"a": 1, "b": 2, "c": 300, "d": "foo"}
     list1 = [1, 2, 10, 3, "abc", "foobar", 3.1415, d1]
     s = csimplejson.dumps(list1)
     list2 = csimplejson.loads(s)
     print "\nunencoded: %s\nencoded: %s\ndecoded: %s" % (list1, s, list2)
     assert list2 == list1
示例#2
0
 def testEncodeDecodeComplicated(self):
     d1 = {'a' : 1, 'b' : 2, 'c' : 300, 'd' : 'foo'}
     list1 = [1, 2, 10, 3, 'abc', 'foobar', 3.1415, d1]
     s = csimplejson.dumps(list1)
     list2 = csimplejson.loads(s)
     print '\nunencoded: %s\nencoded: %s\ndecoded: %s' % (list1, s, list2)
     assert list2 == list1
示例#3
0
 def json_load(cls, content):
     return json.loads(content)
示例#4
0
 def testEncodeDecodeList(self):
     list1 = [1, 2, 10, 3, 'abc', 'foobar', 3.1415]
     s = csimplejson.dumps(list1)
     list2 = csimplejson.loads(s)
     print '\nunencoded: %s\nencoded: %s\ndecoded: %s' % (list1, s, list2)
     assert list2 == list1
示例#5
0
 def testEncodeDecodeDict(self):
     d1 = {'a' : 1, 'b' : 2, 'c' : 300, 'd' : 'foo'}
     s = csimplejson.dumps(d1)
     d2 = csimplejson.loads(s)
     print '\nunencoded: %s\nencoded: %s\ndecoded: %s' % (d1, s, d2)
     assert d2 == d1
示例#6
0
 def testEncodeDecodeList(self):
     list1 = [1, 2, 10, 3, "abc", "foobar", 3.1415]
     s = csimplejson.dumps(list1)
     list2 = csimplejson.loads(s)
     print "\nunencoded: %s\nencoded: %s\ndecoded: %s" % (list1, s, list2)
     assert list2 == list1
示例#7
0
 def testEncodeDecodeDict(self):
     d1 = {"a": 1, "b": 2, "c": 300, "d": "foo"}
     s = csimplejson.dumps(d1)
     d2 = csimplejson.loads(s)
     print "\nunencoded: %s\nencoded: %s\ndecoded: %s" % (d1, s, d2)
     assert d2 == d1
示例#8
0
 def json_load(cls, content):
     return json.loads(content)