File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,15 @@ def check_future_import(node):
19
19
node .children [1 ].type == token .NAME and
20
20
node .children [1 ].value == u'__future__' ):
21
21
return set ()
22
- node = node .children [3 ]
22
+
23
+ if node .children [3 ].type == token .LPAR :
24
+ # from __future__ import (..
25
+ node = node .children [4 ]
26
+ else :
27
+ # from __future__ import ...
28
+ node = node .children [3 ]
23
29
# now node is the import_as_name[s]
30
+
24
31
# print(python_grammar.number2symbol[node.type])
25
32
if node .type == syms .import_as_names :
26
33
result = set ()
Original file line number Diff line number Diff line change @@ -111,8 +111,22 @@ def test_problematic_file():
111
111
print("abc")
112
112
""" )
113
113
114
+ FUTURE_IMPORT_PAREN = ("""\
115
+ from __future__ import (absolute_import, division, print_function)
116
+ unicode("abc")
117
+ """ , """\
118
+ from __future__ import (absolute_import, division, print_function)
119
+ import six
120
+ six.text_type("abc")
121
+ """
122
+ )
123
+
114
124
def test_future_import_as ():
115
125
check_on_input (* FUTURE_IMPORT_AS )
116
126
117
127
def test_future_import_as_multiple ():
118
128
check_on_input (* FUTURE_IMPORT_AS_MULTIPLE )
129
+
130
+ def test_future_import_paren ():
131
+ check_on_input (* FUTURE_IMPORT_PAREN )
132
+
You can’t perform that action at this time.
0 commit comments