Skip to content

Commit f06681e

Browse files
committed
Fix bad import in test.
Also adds an additional test for iteritems in a list context.
1 parent b7fab3e commit f06681e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tests/test_fix_dict_six.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import absolute_import
22

3-
from libmodernize.tests.utils import check_on_input
3+
from utils import check_on_input
44

55

66
TYPES = 'keys', 'items', 'values'
@@ -45,6 +45,16 @@
4545
pass
4646
""")
4747

48+
DICT_ITER_IN_LIST = ("""\
49+
for k in list(x.iter{type}()):
50+
pass
51+
""", """\
52+
from __future__ import absolute_import
53+
import six
54+
for k in list(six.iter{type}(x)):
55+
pass
56+
""")
57+
4858
CHAINED_CALLS = ("""\
4959
(x + y).foo().iter{type}().bar()
5060
""", """\
@@ -73,5 +83,8 @@ def test_dict_in_loop():
7383
def test_dict_iter_in_loop():
7484
check_all_types(*DICT_ITER_IN_LOOP)
7585

86+
def test_dict_iter_in_list():
87+
check_all_types(*DICT_ITER_IN_LIST)
88+
7689
def test_chained_calls():
7790
check_all_types(*CHAINED_CALLS)

0 commit comments

Comments
 (0)