コード例 #1
0
def test_all_together():
    assert [
        "abcd", "heyhey\nhoho", "unset nonewlines", "set tabsize 2",
        "unset tabstospaces", "set fill 78"
    ] == list(
        iter_rc_file_from_config(
            [mock_path("abcd"), mock_path("heyhey\nhoho")], {
                "end_of_line": "lf",
                "insert_final_newline": "true",
                "charset": "utf-8",
                "indent_size": "2",
                "indent_style": "tab",
                "trim_trailing_whitespace": "true",
                "max_line_length": "78",
                "tab_width": "8"
            }))
コード例 #2
0
def test_max_line_length():
    assert ["set fill 118"
            ] == list(iter_rc_file_from_config([], {"max_line_length": 118}))
コード例 #3
0
def test_indent_style_tab():
    assert ["unset tabstospaces"
            ] == list(iter_rc_file_from_config([], {"indent_style": "tab"}))
コード例 #4
0
def test_ident_style_space():
    assert ["set tabstospaces"
            ] == list(iter_rc_file_from_config([], {"indent_style": "space"}))
コード例 #5
0
def test_no_path_base():
    assert [] == list(iter_rc_file_from_config([], {}))
コード例 #6
0
def test_indent_size_precedence():
    assert ["set tabsize 4"] == list(
        iter_rc_file_from_config([], {
            "tab_width": 8,
            "indent_size": 4
        }))
コード例 #7
0
def test_indent_size_from_tab_width():
    assert ["set tabsize 2"
            ] == list(iter_rc_file_from_config([], {"tab_width": 2}))
コード例 #8
0
def test_indent_size():
    assert ["set tabsize 4"
            ] == list(iter_rc_file_from_config([], {"indent_size": 4}))
コード例 #9
0
def test_final_newline_false():
    assert ["set nonewlines"] == list(
        iter_rc_file_from_config([], {"insert_final_newline": "false"}))
コード例 #10
0
def test_path_not_a_file():
    p = mock_path("not gonna see this")
    p.is_file.return_value = False
    assert [] == list(iter_rc_file_from_config([p], {}))
コード例 #11
0
def test_few_paths_base():
    p1 = mock_path("asdf\nqwer")
    p2 = mock_path("heyhey")
    p3 = mock_path("1\n2\n3")
    assert ["asdf\nqwer", "heyhey",
            "1\n2\n3"] == list(iter_rc_file_from_config([p1, p2, p3], {}))