File: test_fix_raise.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-- 922 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

RAISE = (
    """\
raise
""",
    """\
raise
""",
)

RAISE_EXC = (
    """\
raise e
""",
    """\
raise e
""",
)

RAISE_VALUE = (
    """\
raise e, v
""",
    """\
raise e(v)
""",
)

RAISE_TUPLE = (
    """\
raise ((((E1, E2), E3), E4), E5), V
""",
    """\
raise E1(V)
""",
)

# Can't be converted; translation would emit a warning.
RAISE_STRING = (
    """\
raise 'exception'
""",
    """\
raise 'exception'
""",
)

RAISE_TUPLE_ARGS = (
    """\
raise e, (1, 2)
""",
    """\
raise e(1, 2)
""",
)


def test_raise():
    check_on_input(*RAISE)


def test_raise_exc():
    check_on_input(*RAISE_EXC)


def test_raise_value():
    check_on_input(*RAISE_VALUE)


def test_raise_tuple():
    check_on_input(*RAISE_TUPLE)


def test_raise_string():
    check_on_input(*RAISE_STRING)


def test_raise_tuple_args():
    check_on_input(*RAISE_TUPLE_ARGS)