summaryrefslogtreecommitdiffstats
path: root/tests/test_expressions.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_expressions.py')
-rw-r--r--tests/test_expressions.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/test_expressions.py b/tests/test_expressions.py
index d42eeca..11f8fd3 100644
--- a/tests/test_expressions.py
+++ b/tests/test_expressions.py
@@ -249,7 +249,7 @@ class TestExpressions(unittest.TestCase):
{"example.table": "`my-project.example.table`"},
dialect="bigquery",
).sql(),
- 'SELECT * FROM "my-project".example.table /* example.table */',
+ 'SELECT * FROM "my-project"."example"."table" /* example.table */',
)
def test_expand(self):
@@ -313,6 +313,18 @@ class TestExpressions(unittest.TestCase):
).sql(),
"SELECT * FROM (SELECT a FROM tbl1) WHERE b > 100",
)
+ self.assertEqual(
+ exp.replace_placeholders(
+ parse_one("select * from foo WHERE x > ? AND y IS ?"), 0, False
+ ).sql(),
+ "SELECT * FROM foo WHERE x > 0 AND y IS FALSE",
+ )
+ self.assertEqual(
+ exp.replace_placeholders(
+ parse_one("select * from foo WHERE x > :int1 AND y IS :bool1"), int1=0, bool1=False
+ ).sql(),
+ "SELECT * FROM foo WHERE x > 0 AND y IS FALSE",
+ )
def test_function_building(self):
self.assertEqual(exp.func("max", 1).sql(), "MAX(1)")
@@ -645,6 +657,7 @@ class TestExpressions(unittest.TestCase):
self.assertIsInstance(parse_one("TO_HEX(foo)", read="bigquery"), exp.Hex)
self.assertIsInstance(parse_one("TO_HEX(MD5(foo))", read="bigquery"), exp.MD5)
self.assertIsInstance(parse_one("TRANSFORM(a, b)", read="spark"), exp.Transform)
+ self.assertIsInstance(parse_one("ADD_MONTHS(a, b)"), exp.AddMonths)
def test_column(self):
column = parse_one("a.b.c.d")