Ejemplo n.º 1
0
def test_pyls_format_range(unformatted_document, start, end, expected):
    range = {
        "start": {
            "line": start,
            "character": 0
        },
        "end": {
            "line": end,
            "character": 0
        },
    }

    result = pyls_format_range(unformatted_document, range=range)

    assert result == [{
        "range": {
            "start": {
                "line": start,
                "character": 0
            },
            "end": {
                "line": end + 1,
                "character": 0
            },
        },
        "newText": expected,
    }]
Ejemplo n.º 2
0
def test_pyls_format_range_syntax_error(invalid_document):
    range = {
        "start": {
            "line": 0,
            "character": 0
        },
        "end": {
            "line": 1,
            "character": 0
        }
    }

    result = pyls_format_range(invalid_document, range=range)

    assert result == []
Ejemplo n.º 3
0
def test_pyls_format_range_unchanged(formatted_document):
    range = {
        "start": {
            "line": 0,
            "character": 0
        },
        "end": {
            "line": 1,
            "character": 0
        }
    }

    result = pyls_format_range(formatted_document, range=range)

    assert result == []