diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-13 11:11:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-13 11:11:42 +0000 |
commit | 721d458d4c24741ccbc5519b7ca39234a1a21ff6 (patch) | |
tree | b9f72e1d00aba012f06cdf7b0d75ec5e53640eaf /tests/test_parser.py | |
parent | Adding upstream version 25.1.0. (diff) | |
download | sqlglot-721d458d4c24741ccbc5519b7ca39234a1a21ff6.tar.xz sqlglot-721d458d4c24741ccbc5519b7ca39234a1a21ff6.zip |
Adding upstream version 25.5.1.upstream/25.5.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_parser.py')
-rw-r--r-- | tests/test_parser.py | 9 |
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) |