Пример #1
0
def test_pydocstyle():
    doc = Document(DOC_URI, DOC)
    diags = pydocstyle_lint.pyls_lint(doc)

    assert all([d['source'] == 'pydocstyle' for d in diags])

    # One we're expecting is:
    msg = 'D100: Missing docstring in public module'
    unused_import = [d for d in diags if d['message'] == msg][0]

    assert unused_import['range']['start'] == {'line': 0, 'character': 0}
Пример #2
0
def test_pydocstyle():
    doc = Document(DOC_URI, DOC)
    diags = pydocstyle_lint.pyls_lint(doc)

    assert all([d['source'] == 'pydocstyle' for d in diags])

    # One we're expecting is:
    assert diags[0] == {
        'code': 'D100',
        'message': 'D100: Missing docstring in public module',
        'severity': lsp.DiagnosticSeverity.Warning,
        'range': {
            'start': {'line': 0, 'character': 0},
            'end': {'line': 0, 'character': 11},
        },
        'source': 'pydocstyle'
    }
Пример #3
0
def test_pydocstyle_invalid_source():
    doc = Document(DOC_URI, "bad syntax")
    diags = pydocstyle_lint.pyls_lint(doc)
    # We're unable to parse the file, so can't get any pydocstyle diagnostics
    assert not diags
Пример #4
0
def test_pydocstyle_empty_source():
    doc = Document(DOC_URI, "")
    diags = pydocstyle_lint.pyls_lint(doc)
    assert diags[0]['message'] == 'D100: Missing docstring in public module'
    assert len(diags) == 1
Пример #5
0
def test_pydocstyle_test_document(config):
    # The default --match argument excludes test_* documents.
    doc = Document(TEST_DOC_URI, "")
    diags = pydocstyle_lint.pyls_lint(config, doc)
    assert not diags