diff options
Diffstat (limited to 'tests/test_generator.py')
-rw-r--r-- | tests/test_generator.py | 10 |
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"' |