File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ def fix_from_imports(red):
40
40
from_imports = red .find_all ("FromImport" )
41
41
for x , node in enumerate (from_imports ):
42
42
values = node .value
43
+ if len (values ) < 2 :
44
+ continue
43
45
if (values [0 ].value == 'flask' ) and (values [1 ].value == 'ext' ):
44
46
# Case 1
45
47
if len (node .value ) == 3 :
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ def test_named_module_import():
45
45
assert output == "import flask_foo as foobar"
46
46
47
47
48
- def test__named_from_import ():
48
+ def test_named_from_import ():
49
49
red = RedBaron ("from flask.ext.foo import bar as baz" )
50
50
output = migrate .fix_tester (red )
51
51
assert output == "from flask_foo import bar as baz"
@@ -69,3 +69,9 @@ def test_nested_function_call_migration():
69
69
output = migrate .fix_tester (red )
70
70
assert output == ("import flask_foo\n \n "
71
71
"flask_foo.bar(var)" )
72
+
73
+
74
+ def test_no_change_to_import ():
75
+ red = RedBaron ("from flask import Flask" )
76
+ output = migrate .fix_tester (red )
77
+ assert output == "from flask import Flask"
You can’t perform that action at this time.
0 commit comments