From 721d458d4c24741ccbc5519b7ca39234a1a21ff6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Jul 2024 13:11:42 +0200 Subject: Adding upstream version 25.5.1. Signed-off-by: Daniel Baumann --- tests/test_jsonpath.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'tests/test_jsonpath.py') diff --git a/tests/test_jsonpath.py b/tests/test_jsonpath.py index 4daf3c1..c939c52 100644 --- a/tests/test_jsonpath.py +++ b/tests/test_jsonpath.py @@ -2,8 +2,9 @@ import json import os import unittest -from sqlglot import exp, jsonpath +from sqlglot import exp from sqlglot.errors import ParseError, TokenError +from sqlglot.jsonpath import parse from tests.helpers import FIXTURES_DIR @@ -25,7 +26,7 @@ class TestJsonpath(unittest.TestCase): exp.JSONPathSelector(this=exp.JSONPathScript(this="@.x)")), ] self.assertEqual( - jsonpath.parse("$.*.a[0]['x'][*, 'y', 1].z[?(@.a == 'b'), 1:][1:5][1,?@.a][(@.x)]"), + parse("$.*.a[0]['x'][*, 'y', 1].z[?(@.a == 'b'), 1:][1:5][1,?@.a][(@.x)]"), exp.JSONPath(expressions=expected_expressions), ) @@ -36,7 +37,7 @@ class TestJsonpath(unittest.TestCase): ("$[((@.length-1))]", "$[((@.length-1))]"), ): with self.subTest(f"{selector} -> {expected}"): - self.assertEqual(jsonpath.parse(selector).sql(), f"'{expected}'") + self.assertEqual(parse(selector).sql(), f"'{expected}'") def test_cts_file(self): with open(os.path.join(FIXTURES_DIR, "jsonpath", "cts.json")) as file: @@ -131,9 +132,9 @@ class TestJsonpath(unittest.TestCase): with self.subTest(f"{selector.strip()} /* {test['name']} */"): if test.get("invalid_selector"): try: - jsonpath.parse(selector) + parse(selector) except (ParseError, TokenError): pass else: - path = jsonpath.parse(selector) + path = parse(selector) self.assertEqual(path.sql(), f"'{overrides.get(selector, selector)}'") -- cgit v1.2.3