1
0
Fork 0
sqlglot/tests/test_tokens.py
Daniel Baumann b7d21c45b7
Merging upstream version 10.0.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-02-13 14:53:05 +01:00

18 lines
528 B
Python

import unittest
from sqlglot.tokens import Tokenizer
class TestTokens(unittest.TestCase):
def test_comment_attachment(self):
tokenizer = Tokenizer()
sql_comment = [
("/*comment*/ foo", "comment"),
("/*comment*/ foo --test", "comment"),
("--comment\nfoo --test", "comment"),
("foo --comment", "comment"),
("foo", None),
]
for sql, comment in sql_comment:
self.assertEqual(tokenizer.tokenize(sql)[0].comment, comment)