summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2020-09-30 08:11:53 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2020-09-30 08:11:53 +0200
commitcd4a723ee509437166b0f3e0fd62322ecc7bbd99 (patch)
treecd009dc2b36475f21e2f17f645dc56d0dd219598 /tests
parent3e8076dbe225f84592ba2e3029b06cb438c05acd (diff)
downloadsqlparse-cd4a723ee509437166b0f3e0fd62322ecc7bbd99.tar.gz
Don't make parsing of square bracket identifiers too greedy (fixes #583).
Diffstat (limited to 'tests')
-rw-r--r--tests/test_parse.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_parse.py b/tests/test_parse.py
index 6cce909..5fe6ed2 100644
--- a/tests/test_parse.py
+++ b/tests/test_parse.py
@@ -100,6 +100,12 @@ def test_parse_square_brackets_notation_isnt_too_greedy():
assert t[0].tokens[-1].get_real_name() == '[bar]'
+def test_parse_square_brackets_notation_isnt_too_greedy2():
+ # see issue583
+ t = sqlparse.parse('[(foo[i])]')[0].tokens
+ assert isinstance(t[0], sql.SquareBrackets) # not Identifier!
+
+
def test_parse_keyword_like_identifier():
# see issue47
t = sqlparse.parse('foo.key')[0].tokens