File: test_fix_zip.py

package info (click to toggle)
modernize 0.9-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 416 kB
  • sloc: python: 2,016; makefile: 145
file content (82 lines) | stat: -rw-r--r-- 1,181 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from __future__ import generator_stop

from utils import check_on_input

ZIP_CALL_NO_ARGS = (
    """\
zip()
""",
    """\
from __future__ import absolute_import
from six.moves import zip
list(zip())
""",
)

ZIP_CALL_1_ARG = (
    """\
zip(x)
""",
    """\
from __future__ import absolute_import
from six.moves import zip
list(zip(x))
""",
)

ZIP_CALL_2_ARGS = (
    """\
zip(x, y)
zip(w, z)
""",
    """\
from __future__ import absolute_import
from six.moves import zip
list(zip(x, y))
list(zip(w, z))
""",
)

ZIP_CALL_STAR_ARGS = (
    """\
zip(*args)
""",
    """\
from __future__ import absolute_import
from six.moves import zip
list(zip(*args))
""",
)

ZIP_ITERATOR_CONTEXT = (
    """\
for a in zip(x):
    pass
""",
    """\
from __future__ import absolute_import
from six.moves import zip
for a in zip(x):
    pass
""",
)


def test_zip_call_no_args():
    check_on_input(*ZIP_CALL_NO_ARGS)


def test_zip_call_1_arg():
    check_on_input(*ZIP_CALL_1_ARG)


def test_zip_call_2_args():
    check_on_input(*ZIP_CALL_2_ARGS)


def test_zip_call_star_args():
    check_on_input(*ZIP_CALL_STAR_ARGS)


def test_zip_iterator_context():
    check_on_input(*ZIP_ITERATOR_CONTEXT)