diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-14 05:42:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-14 05:42:58 +0000 |
commit | b0bf1ad1a196585c2d31bc38c554637fc4e2eec9 (patch) | |
tree | 2fe11cc45ff45169984b4dfb7b64661d1897ad9c /tests/test_parser.py | |
parent | Adding upstream version 17.3.0. (diff) | |
download | sqlglot-b0bf1ad1a196585c2d31bc38c554637fc4e2eec9.tar.xz sqlglot-b0bf1ad1a196585c2d31bc38c554637fc4e2eec9.zip |
Adding upstream version 17.4.1.upstream/17.4.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/test_parser.py | 57 |
1 files changed, 1 insertions, 56 deletions
diff --git a/tests/test_parser.py b/tests/test_parser.py index 891dcef..07686af 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -571,7 +571,7 @@ class TestParser(unittest.TestCase): """ ) self.assertIsNotNone(query) - self.assertLessEqual(time.time() - now, 0.1) + self.assertLessEqual(time.time() - now, 0.2) def test_parse_properties(self): self.assertEqual( @@ -580,58 +580,3 @@ class TestParser(unittest.TestCase): def test_parse_floats(self): self.assertTrue(parse_one("1. ").is_number) - - def test_parse_wrapped_tables(self): - expr = parse_one("select * from (table)") - self.assertIsInstance(expr.args["from"].this, exp.Table) - self.assertTrue(expr.args["from"].this.args["wrapped"]) - - expr = parse_one("select * from (((table)))") - self.assertIsInstance(expr.args["from"].this, exp.Table) - self.assertTrue(expr.args["from"].this.args["wrapped"]) - - self.assertEqual(expr.sql(), "SELECT * FROM (table)") - - expr = parse_one("select * from (tbl1 join tbl2)") - self.assertIsInstance(expr.args["from"].this, exp.Table) - self.assertTrue(expr.args["from"].this.args["wrapped"]) - self.assertEqual(len(expr.args["from"].this.args["joins"]), 1) - - expr = parse_one("select * from (tbl1 join tbl2) t") - self.assertIsInstance(expr.args["from"].this, exp.Subquery) - self.assertIsInstance(expr.args["from"].this.this, exp.Select) - self.assertEqual(expr.sql(), "SELECT * FROM (SELECT * FROM tbl1, tbl2) AS t") - - expr = parse_one("select * from (tbl as tbl) t") - self.assertEqual(expr.sql(), "SELECT * FROM (SELECT * FROM tbl AS tbl) AS t") - - expr = parse_one("select * from ((a cross join b) cross join c)") - self.assertIsInstance(expr.args["from"].this, exp.Table) - self.assertTrue(expr.args["from"].this.args["wrapped"]) - self.assertEqual(len(expr.args["from"].this.args["joins"]), 2) - self.assertEqual(expr.sql(), "SELECT * FROM (a CROSS JOIN b CROSS JOIN c)") - - expr = parse_one("select * from ((a cross join b) cross join c) t") - self.assertIsInstance(expr.args["from"].this, exp.Subquery) - self.assertEqual(len(expr.args["from"].this.this.args["joins"]), 2) - self.assertEqual( - expr.sql(), "SELECT * FROM (SELECT * FROM a CROSS JOIN b CROSS JOIN c) AS t" - ) - - expr = parse_one("select * from (a cross join (b cross join c))") - self.assertIsInstance(expr.args["from"].this, exp.Table) - self.assertTrue(expr.args["from"].this.args["wrapped"]) - self.assertEqual(len(expr.args["from"].this.args["joins"]), 1) - self.assertIsInstance(expr.args["from"].this.args["joins"][0].this, exp.Table) - self.assertTrue(expr.args["from"].this.args["joins"][0].this.args["wrapped"]) - self.assertEqual(expr.sql(), "SELECT * FROM (a CROSS JOIN (b CROSS JOIN c))") - - expr = parse_one("select * from ((a cross join ((b cross join c) cross join d)))") - self.assertEqual(expr.sql(), "SELECT * FROM (a CROSS JOIN (b CROSS JOIN c CROSS JOIN d))") - - expr = parse_one( - "select * from ((a cross join ((b cross join c) cross join (d cross join e))))" - ) - self.assertEqual( - expr.sql(), "SELECT * FROM (a CROSS JOIN (b CROSS JOIN c CROSS JOIN (d CROSS JOIN e)))" - ) |