summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2016-10-01 14:07:52 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2016-10-01 14:07:52 +0200
commitf0754a6b6540e37c8aa270975194101024d4b2f8 (patch)
tree3464acf94cef7178d766ed66f8ed79593042a199 /tests
parent08862d24091faa2bfe80972df142e12575b7790c (diff)
downloadsqlparse-f0754a6b6540e37c8aa270975194101024d4b2f8.tar.gz
Handle operator grouping after identifying typecasts (fixes #297).
Diffstat (limited to 'tests')
-rw-r--r--tests/test_grouping.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_grouping.py b/tests/test_grouping.py
index 655ef0f..20151a1 100644
--- a/tests/test_grouping.py
+++ b/tests/test_grouping.py
@@ -64,6 +64,20 @@ def test_grouping_identifiers():
assert identifiers[0].get_alias() == "col"
+@pytest.mark.parametrize('s', [
+ 'foo, bar',
+ 'sum(a), sum(b)',
+ 'sum(a) as x, b as y',
+ 'sum(a)::integer, b',
+ 'sum(a)/count(b) as x, y',
+ 'sum(a)::integer as x, y',
+ 'sum(a)::integer/count(b) as x, y', # issue297
+])
+def test_group_identifier_list(s):
+ parsed = sqlparse.parse(s)[0]
+ assert isinstance(parsed.tokens[0], sql.IdentifierList)
+
+
def test_grouping_identifier_wildcard():
p = sqlparse.parse('a.*, b.id')[0]
assert isinstance(p.tokens[0], sql.IdentifierList)