summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2009-04-24 15:16:49 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2009-04-24 15:16:49 +0200
commit1fed923e6ccc06b09417e3026d8694328c1dd68f (patch)
tree205e3ea59e25523bab50e0cd5fab568111643a82 /tests
parentbe3b2d73ef118fa5bbf1549e2f9a71baae709cea (diff)
downloadsqlparse-1fed923e6ccc06b09417e3026d8694328c1dd68f.tar.gz
Recurse into subgroups when grouping case statements.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_grouping.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_grouping.py b/tests/test_grouping.py
index 26e5d10..f3617ad 100644
--- a/tests/test_grouping.py
+++ b/tests/test_grouping.py
@@ -55,6 +55,18 @@ class TestGrouping(TestCaseBase):
self.assertEqual(t.get_name(), '*')
self.assertEqual(t.is_wildcard(), True)
+ def test_identifier_list(self):
+ p = sqlparse.parse('a, b, c')[0]
+ self.assert_(isinstance(p.tokens[0], IdentifierList))
+ p = sqlparse.parse('(a, b, c)')[0]
+ self.assert_(isinstance(p.tokens[0].tokens[1], IdentifierList))
+
+ def test_identifier_list_case(self):
+ p = sqlparse.parse('a, case when 1 then 2 else 3 end as b, c')[0]
+ self.assert_(isinstance(p.tokens[0], IdentifierList))
+ p = sqlparse.parse('(a, case when 1 then 2 else 3 end as b, c)')[0]
+ self.assert_(isinstance(p.tokens[0].tokens[1], IdentifierList))
+
def test_where(self):
s = 'select * from foo where bar = 1 order by id desc'
p = sqlparse.parse(s)[0]