summaryrefslogtreecommitdiffstats
path: root/tests/test_parser.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-13 11:12:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-13 11:12:05 +0000
commit6d546bfddf465f629d17ee52f78b477eb632fd91 (patch)
tree525fd07ca45a5972930252d7f6c9ff5566be9ee7 /tests/test_parser.py
parentReleasing debian version 25.1.0-1. (diff)
downloadsqlglot-6d546bfddf465f629d17ee52f78b477eb632fd91.tar.xz
sqlglot-6d546bfddf465f629d17ee52f78b477eb632fd91.zip
Merging upstream version 25.5.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/test_parser.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_parser.py b/tests/test_parser.py
index d6849c3..f360b43 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -14,6 +14,8 @@ class TestParser(unittest.TestCase):
parse_one("")
def test_parse_into(self):
+ self.assertIsInstance(parse_one("select * from t", into=exp.Select), exp.Select)
+ self.assertIsInstance(parse_one("select * from t limit 5", into=exp.Select), exp.Select)
self.assertIsInstance(parse_one("left join foo", into=exp.Join), exp.Join)
self.assertIsInstance(parse_one("int", into=exp.DataType), exp.DataType)
self.assertIsInstance(parse_one("array<int>", into=exp.DataType), exp.DataType)
@@ -102,6 +104,13 @@ class TestParser(unittest.TestCase):
def test_float(self):
self.assertEqual(parse_one(".2"), parse_one("0.2"))
+ def test_unnest(self):
+ unnest_sql = "UNNEST(foo)"
+ expr = parse_one(unnest_sql)
+ self.assertIsInstance(expr, exp.Unnest)
+ self.assertIsInstance(expr.expressions, list)
+ self.assertEqual(expr.sql(), unnest_sql)
+
def test_unnest_projection(self):
expr = parse_one("SELECT foo IN UNNEST(bla) AS bar")
self.assertIsInstance(expr.selects[0], exp.Alias)