Example #1
0
def test_correct_shebang_executable2(
    make_file,
    assert_errors,
    parse_file_tokens,
    default_options,
    template,
    code,
    executable,
):
    """Testing cases when no errors should be reported."""
    path_to_file = make_file('test_file.py', template.format(code), executable)
    file_tokens = parse_file_tokens(path_to_file)

    visitor = comments.ShebangVisitor(
        default_options,
        filename=path_to_file,
        file_tokens=file_tokens,
    )
    visitor.run()

    assert_errors(visitor, [])
Example #2
0
def test_shebang_on_windows(
    make_file,
    monkeypatch,
    assert_errors,
    parse_file_tokens,
    default_options,
    template,
    code,
    executable,
):
    """Testing cases when no errors should be reported."""
    monkeypatch.setattr(comments, 'is_windows', lambda: True)
    path_to_file = make_file('test_file.py', template.format(code), executable)
    file_tokens = parse_file_tokens(path_to_file)

    visitor = comments.ShebangVisitor(
        default_options,
        filename=path_to_file,
        file_tokens=file_tokens,
    )
    visitor.run()

    assert_errors(visitor, [])