summaryrefslogtreecommitdiffstats
path: root/tests/test_expressions.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_expressions.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_expressions.py')
-rw-r--r--tests/test_expressions.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/test_expressions.py b/tests/test_expressions.py
index 118b992..4641233 100644
--- a/tests/test_expressions.py
+++ b/tests/test_expressions.py
@@ -671,6 +671,10 @@ class TestExpressions(unittest.TestCase):
self.assertIsInstance(parse_one("*"), exp.Star)
self.assertEqual(exp.column("a", table="b", db="c", catalog="d"), exp.to_column("d.c.b.a"))
+ dot = exp.column("d", "c", "b", "a", fields=["e", "f"])
+ self.assertIsInstance(dot, exp.Dot)
+ self.assertEqual(dot.sql(), "a.b.c.d.e.f")
+
def test_text(self):
column = parse_one("a.b.c.d.e")
self.assertEqual(column.text("expression"), "e")
@@ -811,14 +815,14 @@ FROM foo""",
)
def test_to_interval(self):
- self.assertEqual(exp.to_interval("1day").sql(), "INTERVAL '1' day")
- self.assertEqual(exp.to_interval(" 5 months").sql(), "INTERVAL '5' months")
+ self.assertEqual(exp.to_interval("1day").sql(), "INTERVAL '1' DAY")
+ self.assertEqual(exp.to_interval(" 5 months").sql(), "INTERVAL '5' MONTHS")
with self.assertRaises(ValueError):
exp.to_interval("bla")
- self.assertEqual(exp.to_interval(exp.Literal.string("1day")).sql(), "INTERVAL '1' day")
+ self.assertEqual(exp.to_interval(exp.Literal.string("1day")).sql(), "INTERVAL '1' DAY")
self.assertEqual(
- exp.to_interval(exp.Literal.string(" 5 months")).sql(), "INTERVAL '5' months"
+ exp.to_interval(exp.Literal.string(" 5 months")).sql(), "INTERVAL '5' MONTHS"
)
with self.assertRaises(ValueError):
exp.to_interval(exp.Literal.string("bla"))