summaryrefslogtreecommitdiffstats
path: root/tests/test_generator.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-07-10 05:36:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-07-10 05:36:25 +0000
commit3517257d82008871c863f71a402742556dacc5cf (patch)
tree65704dee85c7aa830d01426c9bc3080a80c4e863 /tests/test_generator.py
parentAdding upstream version 17.2.0. (diff)
downloadsqlglot-3517257d82008871c863f71a402742556dacc5cf.tar.xz
sqlglot-3517257d82008871c863f71a402742556dacc5cf.zip
Adding upstream version 17.3.0.upstream/17.3.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_generator.py')
-rw-r--r--tests/test_generator.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/test_generator.py b/tests/test_generator.py
index fce5c81..ec90646 100644
--- a/tests/test_generator.py
+++ b/tests/test_generator.py
@@ -1,6 +1,6 @@
import unittest
-from sqlglot import parse_one
+from sqlglot import exp, parse_one
from sqlglot.expressions import Func
from sqlglot.parser import Parser
from sqlglot.tokens import Tokenizer
@@ -30,6 +30,11 @@ class TestGenerator(unittest.TestCase):
expression = NewParser().parse(tokens)[0]
self.assertEqual(expression.sql(), "SELECT SPECIAL_UDF(a, b, c, d + 1) FROM x")
+ self.assertEqual(
+ exp.DateTrunc(this=exp.to_column("event_date"), unit=exp.var("MONTH")).sql(),
+ "DATE_TRUNC(MONTH, event_date)",
+ )
+
def test_identify(self):
assert parse_one("x").sql(identify=True) == '"x"'
assert parse_one("x").sql(identify="always") == '"x"'