summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2011-07-20 08:28:49 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2011-07-20 08:28:49 +0200
commitd1956f27183c96f092a70a37e172f2fd045932a7 (patch)
treeb02031d25d2e644e2cff603469684815c34c8716 /tests
parentf6f2e20e4c61d50fbd5cbf0e685b03d8c5927a3a (diff)
downloadsqlparse-d1956f27183c96f092a70a37e172f2fd045932a7.tar.gz
Avoid parsing of names as keywords (fixes issue39).
Diffstat (limited to 'tests')
-rw-r--r--tests/test_regressions.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_regressions.py b/tests/test_regressions.py
index 6624d33..10c5608 100644
--- a/tests/test_regressions.py
+++ b/tests/test_regressions.py
@@ -46,3 +46,13 @@ class RegressionTests(TestCaseBase):
self.ndiffAssertEqual(sql, "SELECT foo;")
sql = sqlparse.format("/* foo */", strip_comments=True)
self.ndiffAssertEqual(sql, "")
+
+ def test_issue39(self):
+ p = sqlparse.parse('select user.id from user')[0]
+ self.assertEqual(len(p.tokens), 7)
+ idt = p.tokens[2]
+ self.assertEqual(idt.__class__, sql.Identifier)
+ self.assertEqual(len(idt.tokens), 3)
+ self.assertEqual(idt.tokens[0].match(T.Name, 'user'), True)
+ self.assertEqual(idt.tokens[1].match(T.Punctuation, '.'), True)
+ self.assertEqual(idt.tokens[2].match(T.Name, 'id'), True)