File: test_fix_input_six.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 (80 lines) | stat: -rw-r--r-- 1,086 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
from __future__ import generator_stop

from utils import check_on_input

INPUT = (
    """\
input()
""",
    """\
from __future__ import absolute_import
from six.moves import input
eval(input())
""",
)

INPUT_ARGS = (
    """\
input('hello')
""",
    """\
from __future__ import absolute_import
from six.moves import input
eval(input('hello'))
""",
)

RAW_INPUT = (
    """\
raw_input()
""",
    """\
from __future__ import absolute_import
from six.moves import input
input()
""",
)

RAW_INPUT_TRAILER = (
    """\
raw_input()[0]
""",
    """\
from __future__ import absolute_import
from six.moves import input
input()[0]
""",
)

RAW_INPUT_INPUT = (
    """\
raw_input()
input()
""",
    """\
from __future__ import absolute_import
from six.moves import input
input()
eval(input())
""",
)


def test_input():
    check_on_input(*INPUT)


def test_input_args():
    check_on_input(*INPUT_ARGS)


def test_raw_input():
    check_on_input(*RAW_INPUT)


def test_raw_input_trailer():
    check_on_input(*RAW_INPUT_TRAILER)


def test_raw_input_input():
    check_on_input(*RAW_INPUT_INPUT)