File: test_fix_open.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 (30 lines) | stat: -rw-r--r-- 583 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
from __future__ import generator_stop

from utils import check_on_input

OPEN = (
    """\
{0}('some/path')
""",
    """\
from io import open
open('some/path')
""",
)


def test_open():
    check_on_input(
        OPEN[0].format("open"),
        OPEN[1],
        extra_flags=["-f", "modernize.fixes.fix_open"],
    )


def test_open_optional():
    check_on_input(OPEN[0].format("open"), OPEN[0].format("open"))


def test_file():
    flags = ["-f", "modernize.fixes.fix_open", "-f", "modernize.fixes.fix_file"]
    check_on_input(OPEN[0].format("file"), OPEN[1], extra_flags=flags)