summaryrefslogtreecommitdiff
path: root/tests/test_grouping.py
diff options
context:
space:
mode:
authorVictor Uriarte <victor.m.uriarte@intel.com>2016-06-04 21:57:43 -0700
committerVictor Uriarte <victor.m.uriarte@intel.com>2016-06-06 06:31:35 -0700
commita7c7d9586208516de372cb01203b48a53f7095fb (patch)
tree95e887de388e5f6f1516b1ea862e9d48a4d174eb /tests/test_grouping.py
parent035ffb8e61b2cda516ae448246df36451ff6d14b (diff)
downloadsqlparse-a7c7d9586208516de372cb01203b48a53f7095fb.tar.gz
Format `pr` to pass flake8 and update functions used
Diffstat (limited to 'tests/test_grouping.py')
-rw-r--r--tests/test_grouping.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/test_grouping.py b/tests/test_grouping.py
index 40a35cf..fdcd4a7 100644
--- a/tests/test_grouping.py
+++ b/tests/test_grouping.py
@@ -122,15 +122,16 @@ class TestGrouping(TestCaseBase):
p = sqlparse.parse('(a, b, c)')[0]
self.assert_(isinstance(p.tokens[0].tokens[1], sql.IdentifierList))
- @pytest.mark.xfail(strict=True)
def test_identifier_list_subquery(self):
"""identifier lists should still work in subqueries with aliases"""
- p = sqlparse.parse("""select * from (select a, b + c as d from table) sub""")[0]
+ p = sqlparse.parse("select * from ("
+ "select a, b + c as d from table) sub")[0]
subquery = p.tokens[-1].tokens[0]
- iden_list = subquery.token_next_by_instance(0, sql.IdentifierList)
+ iden_list = subquery.token_next_by(i=sql.IdentifierList)
self.assert_(iden_list is not None)
# all the identifiers should be within the IdentifierList
- self.assert_(subquery.token_next_by_instance(subquery.token_index(iden_list), sql.Identifier) is None)
+ self.assert_(subquery.token_next_by(i=sql.Identifier,
+ idx=iden_list) is None)
def test_identifier_list_case(self):
p = sqlparse.parse('a, case when 1 then 2 else 3 end as b, c')[0]
@@ -152,7 +153,8 @@ class TestGrouping(TestCaseBase):
def test_identifiers_with_operators(self):
p = sqlparse.parse('a+b as c from table where (d-e)%2= 1')[0]
- self.assertEqual(len([x for x in p.flatten() if x.ttype == sqlparse.tokens.Name]), 5)
+ self.assertEqual(len([x for x in p.flatten()
+ if x.ttype == sqlparse.tokens.Name]), 5)
def test_identifier_list_with_order(self): # issue101
p = sqlparse.parse('1, 2 desc, 3')[0]