summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2016-04-06 09:41:31 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2016-04-06 09:41:31 +0200
commit9ab1464ea9c1d0296d698d9637ed3e3cd92326f9 (patch)
treefa0b598c77018f2bd0bbfc985f4086548f10b11b /tests
parentbaeea12b776b1f4477ee5af80aaa2e7c44fadf0e (diff)
downloadsqlparse-9ab1464ea9c1d0296d698d9637ed3e3cd92326f9.tar.gz
Improve identifier parsing when identifier is a literal combined with order keyword (fixes #101).
Diffstat (limited to 'tests')
-rw-r--r--tests/test_grouping.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_grouping.py b/tests/test_grouping.py
index 9a9dd6a..7dc1269 100644
--- a/tests/test_grouping.py
+++ b/tests/test_grouping.py
@@ -140,6 +140,12 @@ class TestGrouping(TestCaseBase):
self.assert_(isinstance(p.tokens[0].tokens[0], sql.Identifier))
self.assert_(isinstance(p.tokens[0].tokens[3], sql.Identifier))
+ def test_identifier_list_with_order(self): # issue101
+ p = sqlparse.parse('1, 2 desc, 3')[0]
+ self.assert_(isinstance(p.tokens[0], sql.IdentifierList))
+ self.assert_(isinstance(p.tokens[0].tokens[3], sql.Identifier))
+ self.ndiffAssertEqual(u(p.tokens[0].tokens[3]), '2 desc')
+
def test_where(self):
s = 'select * from foo where bar = 1 order by id desc'
p = sqlparse.parse(s)[0]