summaryrefslogtreecommitdiffstats
path: root/tests/test_generator.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-19 10:22:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-19 10:22:04 +0000
commit57c3067868d0a1da90ec0f2201dd91f031241274 (patch)
tree3b16819683e27ccbc7e7726675ab8d3e978fc8aa /tests/test_generator.py
parentAdding upstream version 11.3.6. (diff)
downloadsqlglot-57c3067868d0a1da90ec0f2201dd91f031241274.tar.xz
sqlglot-57c3067868d0a1da90ec0f2201dd91f031241274.zip
Adding upstream version 11.4.1.upstream/11.4.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_generator.py')
-rw-r--r--tests/test_generator.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_generator.py b/tests/test_generator.py
index d64a818..fce5c81 100644
--- a/tests/test_generator.py
+++ b/tests/test_generator.py
@@ -1,5 +1,6 @@
import unittest
+from sqlglot import parse_one
from sqlglot.expressions import Func
from sqlglot.parser import Parser
from sqlglot.tokens import Tokenizer
@@ -28,3 +29,12 @@ class TestGenerator(unittest.TestCase):
tokens = Tokenizer().tokenize("SELECT SPECIAL_UDF(a, b, c, d + 1) FROM x")
expression = NewParser().parse(tokens)[0]
self.assertEqual(expression.sql(), "SELECT SPECIAL_UDF(a, b, c, d + 1) FROM x")
+
+ def test_identify(self):
+ assert parse_one("x").sql(identify=True) == '"x"'
+ assert parse_one("x").sql(identify="always") == '"x"'
+ assert parse_one("X").sql(identify="always") == '"X"'
+ assert parse_one("x").sql(identify="safe") == '"x"'
+ assert parse_one("X").sql(identify="safe") == "X"
+ assert parse_one("x as 1").sql(identify="safe") == '"x" AS "1"'
+ assert parse_one("X as 1").sql(identify="safe") == 'X AS "1"'