From 26b5385babe69ced19e02dc4643a91f6aaf3a1a6 Mon Sep 17 00:00:00 2001 From: koljonen Date: Sat, 14 May 2016 21:54:50 +0200 Subject: Recognize USING as a keyword in 'USING(', not just in 'USING (' These were previously caught by (r'[^\W\d_]\w*(?=[.(])', tokens.Name), so I added a special regex just above that one. --- tests/test_grouping.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/test_grouping.py b/tests/test_grouping.py index 7dc1269..89610f8 100644 --- a/tests/test_grouping.py +++ b/tests/test_grouping.py @@ -380,6 +380,13 @@ def test_begin(): assert isinstance(p.tokens[0], sql.Begin) +def test_keyword_followed_by_parenthesis(): + p = sqlparse.parse('USING(somecol')[0] + assert len(p.tokens) == 3 + assert p.tokens[0].ttype == T.Keyword + assert p.tokens[1].ttype == T.Punctuation + + def test_nested_begin(): p = sqlparse.parse('BEGIN foo BEGIN bar END END')[0] assert len(p.tokens) == 1 -- cgit v1.2.1