summaryrefslogtreecommitdiffstats
path: root/tests/test_transpile.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-23 05:06:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-23 05:06:10 +0000
commit258c7df9cab21a4978c100568907ac1cb7fd6ee0 (patch)
treea98c4c9fc7433833be72543de5d99d15b9927442 /tests/test_transpile.py
parentAdding upstream version 20.4.0. (diff)
downloadsqlglot-258c7df9cab21a4978c100568907ac1cb7fd6ee0.tar.xz
sqlglot-258c7df9cab21a4978c100568907ac1cb7fd6ee0.zip
Adding upstream version 20.9.0.upstream/20.9.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_transpile.py')
-rw-r--r--tests/test_transpile.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/test_transpile.py b/tests/test_transpile.py
index fb8f831..51805d9 100644
--- a/tests/test_transpile.py
+++ b/tests/test_transpile.py
@@ -93,6 +93,10 @@ class TestTranspile(unittest.TestCase):
def test_comments(self):
self.validate(
+ "SELECT c /* foo */ AS alias",
+ "SELECT c AS alias /* foo */",
+ )
+ self.validate(
"SELECT c AS /* foo */ (a, b, c) FROM t",
"SELECT c AS (a, b, c) /* foo */ FROM t",
)
@@ -366,7 +370,7 @@ WHERE
""",
"""SELECT
col, /* This is testing comments */
- CASE WHEN a THEN b ELSE c END /* 2nd testing comments */ AS d
+ CASE WHEN a THEN b ELSE c END AS d /* 2nd testing comments */
FROM t""",
pretty=True,
)
@@ -571,11 +575,11 @@ FROM base""",
)
def test_time(self):
- self.validate("INTERVAL '1 day'", "INTERVAL '1' day")
- self.validate("INTERVAL '1 days' * 5", "INTERVAL '1' days * 5")
- self.validate("5 * INTERVAL '1 day'", "5 * INTERVAL '1' day")
- self.validate("INTERVAL 1 day", "INTERVAL '1' day")
- self.validate("INTERVAL 2 months", "INTERVAL '2' months")
+ self.validate("INTERVAL '1 day'", "INTERVAL '1' DAY")
+ self.validate("INTERVAL '1 days' * 5", "INTERVAL '1' DAYS * 5")
+ self.validate("5 * INTERVAL '1 day'", "5 * INTERVAL '1' DAY")
+ self.validate("INTERVAL 1 day", "INTERVAL '1' DAY")
+ self.validate("INTERVAL 2 months", "INTERVAL '2' MONTHS")
self.validate("TIMESTAMP '2020-01-01'", "CAST('2020-01-01' AS TIMESTAMP)")
self.validate("TIMESTAMP WITH TIME ZONE '2020-01-01'", "CAST('2020-01-01' AS TIMESTAMPTZ)")
self.validate(