Exemple #1
0
def test_pyls_format_pyi_document(unformatted_pyi_document, formatted_pyi_document):
    result = pyls_format_document(unformatted_pyi_document)

    assert result == [
        {
            "range": {
                "start": {"line": 0, "character": 0},
                "end": {"line": 5, "character": 0},
            },
            "newText": formatted_pyi_document.source,
        }
    ]
Exemple #2
0
def test_pyls_format_document_with_config(config_document):
    result = pyls_format_document(config_document)

    assert result == [
        {
            "range": {
                "start": {"line": 0, "character": 0},
                "end": {"line": 1, "character": 0},
            },
            "newText": (
                "run(\n"
                "    these,\n"
                "    arguments,\n"
                "    should,\n"
                "    be,\n"
                "    wrapped,\n"
                ")\n"
            ),
        }
    ]
Exemple #3
0
def test_pyls_format_document_syntax_error(invalid_document):
    result = pyls_format_document(invalid_document)

    assert result == []
Exemple #4
0
def test_pyls_format_pyi_document_unchanged(formatted_pyi_document):
    result = pyls_format_document(formatted_pyi_document)

    assert result == []