def test_grouping_identifier_list_subquery():
 p = sqlparse.parse('select * from (select a, b + c as d from table) sub')[0]
 subquery = p.tokens[(-1)].tokens[0]
 (idx, iden_list) = subquery.token_next_by(i=sql.IdentifierList)
 assert (iden_list is not None)
 (_, ilist) = subquery.token_next_by(i=sql.Identifier, idx=idx)
 assert (ilist is None)

def test_grouping_identifier_list_subquery ( ) : p = sqlparse . parse ( 'select * from (select a, b + c as d from table) sub' ) [ 0 ] subquery = p . tokens [ ( - 1 ) ] . tokens [ 0 ] ( idx , iden_list ) = subquery . token_next_by ( i = sql . IdentifierList ) assert ( iden_list is not None ) ( _ , ilist ) = subquery . token_next_by ( i = sql . Identifier , idx = idx ) assert ( ilist is None )
identifier lists should still work in subqueries with aliases .