summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Uriarte <victor.m.uriarte@intel.com>2016-06-12 21:22:07 -0700
committerVictor Uriarte <victor.m.uriarte@intel.com>2016-06-14 03:28:20 -0700
commit405a66817f1b0789901adf9c81b96658a04e6950 (patch)
tree539964c292a7e370bfdb86b9018438b227347247
parent0bcb34cc1514d77446a29c2c636a3f9a653588f2 (diff)
downloadsqlparse-405a66817f1b0789901adf9c81b96658a04e6950.tar.gz
Reapply fix for case within paranthesis
-rw-r--r--sqlparse/engine/grouping.py4
-rw-r--r--tests/test_regressions.py8
2 files changed, 3 insertions, 9 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py
index cae5d23..f9ca6b4 100644
--- a/sqlparse/engine/grouping.py
+++ b/sqlparse/engine/grouping.py
@@ -43,7 +43,9 @@ def _group_left_right(tlist, m, cls,
def _group_matching(tlist, cls):
"""Groups Tokens that have beginning and end."""
- idx = 1 if imt(tlist, i=cls) else 0
+ [_group_matching(sgroup, cls) for sgroup in tlist.get_sublists()
+ if not isinstance(sgroup, cls)]
+ idx = 1 if isinstance(tlist, cls) else 0
opens = []
diff --git a/tests/test_regressions.py b/tests/test_regressions.py
index 3a3406b..b55939a 100644
--- a/tests/test_regressions.py
+++ b/tests/test_regressions.py
@@ -312,11 +312,3 @@ def test_issue207_runaway_format():
" 2 as two,",
" 3",
" from dual) t0"])
-
-
-@pytest.mark.xfail(reason="broke with new indexing")
-def test_case_within_parenthesis():
- # see issue #164
- s = '(case when 1=1 then 2 else 5 end)'
- p = sqlparse.parse(s)[0]
- assert isinstance(p[0][1], sql.Case)