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))
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))
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))
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))
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))
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))
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))
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))