Skip to content

Commit ac21860

Browse files
committed
Proposed tests for fix_import.
Signed-off-by: Daira Hopwood <[email protected]>
1 parent edd83f8 commit ac21860

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tests/test_fix_import.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
from __future__ import absolute_import
2+
3+
from utils import check_on_input
4+
5+
6+
NO_IMPORTS = ("""\
7+
""", """\
8+
""")
9+
10+
ONLY_FUTURE_IMPORTS = ("""\
11+
from __future__ import print_function
12+
""", """\
13+
from __future__ import print_function
14+
""")
15+
16+
ONLY_NORMAL_IMPORTS = ("""\
17+
import foo
18+
""", """\
19+
from __future__ import absolute_import
20+
import foo
21+
""")
22+
23+
NORMAL_AND_FUTURE_IMPORTS = ("""\
24+
from __future__ import print_function
25+
import foo
26+
""", """\
27+
from __future__ import print_function
28+
from __future__ import absolute_import
29+
import foo
30+
""")
31+
32+
33+
def test_no_imports():
34+
check_on_input(*NO_IMPORTS)
35+
36+
def test_only_future_imports():
37+
check_on_input(*ONLY_FUTURE_IMPORTS)
38+
39+
def test_only_normal_imports():
40+
check_on_input(*ONLY_NORMAL_IMPORTS)
41+
42+
def test_normal_and_future_imports():
43+
check_on_input(*NORMAL_AND_FUTURE_IMPORTS)

0 commit comments

Comments
 (0)