diff options
Diffstat (limited to 'tests/test_expressions.py')
-rw-r--r-- | tests/test_expressions.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/tests/test_expressions.py b/tests/test_expressions.py index 7acc0fa..8b74fe1 100644 --- a/tests/test_expressions.py +++ b/tests/test_expressions.py @@ -406,6 +406,8 @@ class TestExpressions(unittest.TestCase): ) def test_functions(self): + self.assertIsInstance(parse_one("x LIKE ANY (y)"), exp.Like) + self.assertIsInstance(parse_one("x ILIKE ANY (y)"), exp.ILike) self.assertIsInstance(parse_one("ABS(a)"), exp.Abs) self.assertIsInstance(parse_one("APPROX_DISTINCT(a)"), exp.ApproxDistinct) self.assertIsInstance(parse_one("ARRAY(a)"), exp.Array) @@ -473,23 +475,24 @@ class TestExpressions(unittest.TestCase): self.assertIsInstance(parse_one("GENERATE_SERIES(a, b, c)"), exp.GenerateSeries) def test_column(self): - dot = parse_one("a.b.c") - column = dot.this - self.assertEqual(column.table, "a") - self.assertEqual(column.name, "b") - self.assertEqual(dot.text("expression"), "c") + column = parse_one("a.b.c.d") + self.assertEqual(column.catalog, "a") + self.assertEqual(column.db, "b") + self.assertEqual(column.table, "c") + self.assertEqual(column.name, "d") column = parse_one("a") self.assertEqual(column.name, "a") self.assertEqual(column.table, "") - fields = parse_one("a.b.c.d") + fields = parse_one("a.b.c.d.e") self.assertIsInstance(fields, exp.Dot) - self.assertEqual(fields.text("expression"), "d") - self.assertEqual(fields.this.text("expression"), "c") + self.assertEqual(fields.text("expression"), "e") column = fields.find(exp.Column) - self.assertEqual(column.name, "b") - self.assertEqual(column.table, "a") + self.assertEqual(column.name, "d") + self.assertEqual(column.table, "c") + self.assertEqual(column.db, "b") + self.assertEqual(column.catalog, "a") column = parse_one("a[0].b") self.assertIsInstance(column, exp.Dot) @@ -505,8 +508,8 @@ class TestExpressions(unittest.TestCase): self.assertIsInstance(parse_one("*"), exp.Star) def test_text(self): - column = parse_one("a.b.c") - self.assertEqual(column.text("expression"), "c") + column = parse_one("a.b.c.d.e") + self.assertEqual(column.text("expression"), "e") self.assertEqual(column.text("y"), "") self.assertEqual(parse_one("select * from x.y").find(exp.Table).text("db"), "x") self.assertEqual(parse_one("select *").name, "") |