summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2009-07-12 09:48:58 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2009-07-12 09:48:58 +0200
commit612c7fd4c2394be0e04cd7b26c380088bfa20306 (patch)
tree03c6726e6efb1297cb2683e18f8074ace839f3a1 /tests
parent9114ff791c224f8edfa6f1ff00ae57e8e3296f75 (diff)
downloadsqlparse-612c7fd4c2394be0e04cd7b26c380088bfa20306.tar.gz
Detect functions if they are used as identifiers.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_grouping.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/test_grouping.py b/tests/test_grouping.py
index 6331317..13d52b9 100644
--- a/tests/test_grouping.py
+++ b/tests/test_grouping.py
@@ -65,7 +65,7 @@ class TestGrouping(TestCaseBase):
self.assertEqual(t.get_name(), '*')
self.assertEqual(t.is_wildcard(), True)
- def test_indentifier_invalid(self):
+ def test_identifier_invalid(self):
p = sqlparse.parse('a.')[0]
self.assert_(isinstance(p.tokens[0], Identifier))
self.assertEqual(p.tokens[0].has_alias(), False)
@@ -73,6 +73,14 @@ class TestGrouping(TestCaseBase):
self.assertEqual(p.tokens[0].get_real_name(), None)
self.assertEqual(p.tokens[0].get_parent_name(), 'a')
+ def test_identifier_function(self):
+ p = sqlparse.parse('foo() as bar')[0]
+ self.assert_(isinstance(p.tokens[0], Identifier))
+ self.assert_(isinstance(p.tokens[0].tokens[0], Function))
+ p = sqlparse.parse('foo()||col2 bar')[0]
+ self.assert_(isinstance(p.tokens[0], Identifier))
+ self.assert_(isinstance(p.tokens[0].tokens[0], Function))
+
def test_identifier_list(self):
p = sqlparse.parse('a, b, c')[0]
self.assert_(isinstance(p.tokens[0], IdentifierList))