summaryrefslogtreecommitdiffstats
path: root/tests/test_expressions.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-26 17:21:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-26 17:21:50 +0000
commit6c774776db5e016d597e582c7006ba8d27006f9d (patch)
tree8a65b7a9938002f9b152d9a6dfd150f15e402a6b /tests/test_expressions.py
parentAdding upstream version 18.13.0. (diff)
downloadsqlglot-6c774776db5e016d597e582c7006ba8d27006f9d.tar.xz
sqlglot-6c774776db5e016d597e582c7006ba8d27006f9d.zip
Adding upstream version 18.17.0.upstream/18.17.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_expressions.py')
-rw-r--r--tests/test_expressions.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_expressions.py b/tests/test_expressions.py
index f8c8bcc..6c48943 100644
--- a/tests/test_expressions.py
+++ b/tests/test_expressions.py
@@ -632,6 +632,11 @@ class TestExpressions(unittest.TestCase):
week = unit.find(exp.Week)
self.assertEqual(week.this, exp.var("thursday"))
+ for abbreviated_unit, unnabreviated_unit in exp.TimeUnit.UNABBREVIATED_UNIT_NAME.items():
+ interval = parse_one(f"interval '500 {abbreviated_unit}'")
+ self.assertIsInstance(interval.unit, exp.Var)
+ self.assertEqual(interval.unit.name, unnabreviated_unit)
+
def test_identifier(self):
self.assertTrue(exp.to_identifier('"x"').quoted)
self.assertFalse(exp.to_identifier("x").quoted)
@@ -861,6 +866,10 @@ FROM foo""",
self.assertEqual(exp.DataType.build("ARRAY<UNKNOWN>").sql(), "ARRAY<UNKNOWN>")
self.assertEqual(exp.DataType.build("ARRAY<NULL>").sql(), "ARRAY<NULL>")
+ self.assertEqual(exp.DataType.build("varchar(100) collate 'en-ci'").sql(), "VARCHAR(100)")
+
+ with self.assertRaises(ParseError):
+ exp.DataType.build("varchar(")
def test_rename_table(self):
self.assertEqual(