diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-14 05:43:02 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-14 05:43:02 +0000 |
commit | c8d4d4ead5df1c84966431eec8b88e974414dafc (patch) | |
tree | 847e292ab98fe79a3a78cd6797b564b73f4d2681 /tests/test_parser.py | |
parent | Releasing debian version 17.3.0-1. (diff) | |
download | sqlglot-c8d4d4ead5df1c84966431eec8b88e974414dafc.tar.xz sqlglot-c8d4d4ead5df1c84966431eec8b88e974414dafc.zip |
Merging upstream version 17.4.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 | 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)))" - ) |