Exemplo n.º 1
0
 def test_large_sequence(self):
     data = "[1,2,3]" + large_json
     expect = [[1,2,3], {'big-thing': big_thing}]
     data_stream = io.StringIO(data)
     got = [x for x in jstream.json_objects(data_stream)]
     self.assertTrue(expect == got, 
             msg="\n  expected: {}\n  got: {}\n".format(expect,got))
Exemplo n.º 2
0
 def test_incomplete_sequence(self):
     data = "[1,2,3" + large_json
     expect = []
     data_stream = io.StringIO(data)
     got = [x for x in jstream.json_objects(data_stream)]
     self.assertTrue(expect == got, 
             msg="\n  expected: {}\n  got: {}\n".format(expect,got))
Exemplo n.º 3
0
 def test_empty_sequence(self):
     data_stream = io.StringIO('')
     expect = []
     got = [x for x in jstream.json_objects(data_stream)]
     self.assertTrue(expect == got,
                     msg="\n  expected: {}\n  got: {}\n".format(
                         expect, got))
Exemplo n.º 4
0
 def test_incomplete_sequence(self):
     data = "[1,2,3" + large_json
     expect = []
     data_stream = io.StringIO(data)
     got = [x for x in jstream.json_objects(data_stream)]
     self.assertTrue(expect == got,
                     msg="\n  expected: {}\n  got: {}\n".format(
                         expect, got))
Exemplo n.º 5
0
 def test_large_sequence(self):
     data = "[1,2,3]" + large_json
     expect = [[1, 2, 3], {'big-thing': big_thing}]
     data_stream = io.StringIO(data)
     got = [x for x in jstream.json_objects(data_stream)]
     self.assertTrue(expect == got,
                     msg="\n  expected: {}\n  got: {}\n".format(
                         expect, got))
Exemplo n.º 6
0
 def test_small_sequence(self):
     data = '''
     [1,2
     ,3]       [4 ,5, 6]
     {"a":
     "b"}
     '''
     expect = [[1,2,3], [4,5,6],{'a':'b'}]
     data_stream = io.StringIO(data)
     got = [x for x in jstream.json_objects(data_stream)]
     self.assertTrue(expect == got, 
             msg="\n  expected: {}\n  got: {}\n".format(expect,got))
Exemplo n.º 7
0
 def test_small_sequence(self):
     data = '''
     [1,2
     ,3]       [4 ,5, 6]
     {"a":
     "b"}
     '''
     expect = [[1, 2, 3], [4, 5, 6], {'a': 'b'}]
     data_stream = io.StringIO(data)
     got = [x for x in jstream.json_objects(data_stream)]
     self.assertTrue(expect == got,
                     msg="\n  expected: {}\n  got: {}\n".format(
                         expect, got))
Exemplo n.º 8
0
 def test_empty_sequence(self):
     data_stream = io.StringIO('')
     expect = []
     got = [x for x in jstream.json_objects(data_stream)]
     self.assertTrue(expect == got,
             msg="\n  expected: {}\n  got: {}\n".format(expect,got))