summaryrefslogtreecommitdiffstats
path: root/tests/test_transpile.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-23 05:06:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-23 05:06:14 +0000
commit38e6461a8afbd7cb83709ddb998f03d40ba87755 (patch)
tree64b68a893a3b946111b9cab69503f83ca233c335 /tests/test_transpile.py
parentReleasing debian version 20.4.0-1. (diff)
downloadsqlglot-38e6461a8afbd7cb83709ddb998f03d40ba87755.tar.xz
sqlglot-38e6461a8afbd7cb83709ddb998f03d40ba87755.zip
Merging upstream version 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(