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)
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"]'])
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}'])
def test_json(self): """Test simple query""" test_str = '"a"' result = list(yield_json_and_json_lines([test_str])) self.assertEqual(result, ['"a"'])
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)
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)