summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2013-09-15 00:07:43 -0700
committerAndi Albrecht <albrecht.andi@gmail.com>2013-09-15 00:07:43 -0700
commit8d703748577844f94dd99383747031be1e3545f9 (patch)
tree5a7f76d66c1ba2d4438fb730816be1e0ceb68007 /tests
parent3b41501e850f3de9c0ac3c480bf63e73aa20a45d (diff)
parent9574c16bc7418e07e3a21a1c00e4ad5956b799c3 (diff)
downloadsqlparse-8d703748577844f94dd99383747031be1e3545f9.tar.gz
Merge pull request #110 from pvatala/master
Parenthesis, Functions and Arithmetic Expressions in Identifiers
Diffstat (limited to 'tests')
-rw-r--r--tests/test_grouping.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_grouping.py b/tests/test_grouping.py
index b22e543..2b7cefd 100644
--- a/tests/test_grouping.py
+++ b/tests/test_grouping.py
@@ -59,6 +59,15 @@ class TestGrouping(TestCaseBase):
self.assertEquals(types, [T.DML, T.Keyword, None,
T.Keyword, None, T.Punctuation])
+ s = "select 1.0*(a+b) as col, sum(c)/sum(d) from myschema.mytable"
+ parsed = sqlparse.parse(s)[0]
+ self.assertEqual(len(parsed.tokens), 7)
+ self.assert_(isinstance(parsed.tokens[2], sql.IdentifierList))
+ self.assertEqual(len(parsed.tokens[2].tokens), 4)
+ identifiers = list(parsed.tokens[2].get_identifiers())
+ self.assertEqual(len(identifiers), 2)
+ self.assertEquals(identifiers[0].get_alias(), u"col")
+
def test_identifier_wildcard(self):
p = sqlparse.parse('a.*, b.id')[0]
self.assert_(isinstance(p.tokens[0], sql.IdentifierList))