summaryrefslogtreecommitdiffstats
path: root/tests/test_transpile.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_transpile.py')
-rw-r--r--tests/test_transpile.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/test_transpile.py b/tests/test_transpile.py
index dea9985..b5e069a 100644
--- a/tests/test_transpile.py
+++ b/tests/test_transpile.py
@@ -112,6 +112,10 @@ class TestTranspile(unittest.TestCase):
def test_comments(self):
self.validate(
+ "select /* asfd /* asdf */ asdf */ 1",
+ "/* asfd /* asdf */ asdf */ SELECT 1",
+ )
+ self.validate(
"SELECT c /* foo */ AS alias",
"SELECT c AS alias /* foo */",
)
@@ -552,7 +556,7 @@ FROM x""",
)
self.validate(
- """SELECT X FROM catalog.db.table WHERE Y
+ """SELECT X FROM catalog.db.table WHERE Y
--
AND Z""",
"""SELECT X FROM catalog.db.table WHERE Y AND Z""",
@@ -585,24 +589,24 @@ FROM x""",
def test_extract(self):
self.validate(
"EXTRACT(day FROM '2020-01-01'::TIMESTAMP)",
- "EXTRACT(day FROM CAST('2020-01-01' AS TIMESTAMP))",
+ "EXTRACT(DAY FROM CAST('2020-01-01' AS TIMESTAMP))",
)
self.validate(
"EXTRACT(timezone FROM '2020-01-01'::TIMESTAMP)",
- "EXTRACT(timezone FROM CAST('2020-01-01' AS TIMESTAMP))",
+ "EXTRACT(TIMEZONE FROM CAST('2020-01-01' AS TIMESTAMP))",
)
self.validate(
"EXTRACT(year FROM '2020-01-01'::TIMESTAMP WITH TIME ZONE)",
- "EXTRACT(year FROM CAST('2020-01-01' AS TIMESTAMPTZ))",
+ "EXTRACT(YEAR FROM CAST('2020-01-01' AS TIMESTAMPTZ))",
)
self.validate(
"extract(month from '2021-01-31'::timestamp without time zone)",
- "EXTRACT(month FROM CAST('2021-01-31' AS TIMESTAMP))",
+ "EXTRACT(MONTH FROM CAST('2021-01-31' AS TIMESTAMP))",
)
- self.validate("extract(week from current_date + 2)", "EXTRACT(week FROM CURRENT_DATE + 2)")
+ self.validate("extract(week from current_date + 2)", "EXTRACT(WEEK FROM CURRENT_DATE + 2)")
self.validate(
"EXTRACT(minute FROM datetime1 - datetime2)",
- "EXTRACT(minute FROM datetime1 - datetime2)",
+ "EXTRACT(MINUTE FROM datetime1 - datetime2)",
)
def test_if(self):