Ejemplo n.º 1
0
 def test_escaped_jsonl_2(self):
     """Test simple query"""
     test_obj = ["a", {"a": 2353, "b": 'sdaf"}f32'}, {"a": 646}]
     test_str = json.dumps(test_obj, sort_keys=True)
     result = list(yield_json_and_json_lines([test_str]))
     expected = ['"a"', '{"a": 2353, "b": "sdaf\\"}f32"}', '{"a": 646}']
     self.assertEqual(result, expected)
Ejemplo n.º 2
0
 def test_jsonl_list_of_lists(self):
     """Test simple query"""
     test_str = '[["a","b"],["c","d"]]'
     result = list(yield_json_and_json_lines([test_str]))
     self.assertEqual(result, ['["a","b"]', '["c","d"]'])
Ejemplo n.º 3
0
 def test_json_2(self):
     """Test simple query"""
     test_str = '[{"a": 2353}, {"a": 646}]'
     result = list(yield_json_and_json_lines([test_str]))
     self.assertEqual(result, ['{"a": 2353}', '{"a": 646}'])
Ejemplo n.º 4
0
 def test_json(self):
     """Test simple query"""
     test_str = '"a"'
     result = list(yield_json_and_json_lines([test_str]))
     self.assertEqual(result, ['"a"'])
Ejemplo n.º 5
0
 def test_char_as_json(self):
     """Test simple query"""
     test_str = '"a"'
     result = list(yield_json_and_json_lines([test_str]))
     expected = ['"a"']
     self.assertEqual(result, expected)
Ejemplo n.º 6
0
 def test_escaped_jsonl(self):
     """Test simple query"""
     test_str = '"a", {"a": 2353, "b": "sdaf\\"}f32"}, {"a": 646}'
     result = list(yield_json_and_json_lines([test_str]))
     expected = ['"a"', '{"a": 2353, "b": "sdaf\\"}f32"}', '{"a": 646}']
     self.assertEqual(result, expected)