Exemplo n.º 1
0
def test_parse_line_with_context(monkeypatch, word, bounds):
    monkeypatch.setattr(Document, 'word_at_position', lambda *args: word)
    doc = Document('file:///some/path')
    diag = plugin.parse_line(TEST_LINE, doc)
    assert diag['message'] == '"Request" has no attribute "id"'
    assert diag['range']['start'] == {'line': 278, 'character': bounds[0]}
    assert diag['range']['end'] == {'line': 278, 'character': bounds[1]}
Exemplo n.º 2
0
def test_parse_line_without_line():
    diag = plugin.parse_line(TEST_LINE_WITHOUT_LINE)
    assert diag['message'] == '"Request" has no attribute "id"'
    assert diag['range']['start'] == {'line': 0, 'character': 0}
    assert diag['range']['end'] == {'line': 0, 'character': 1}
Exemplo n.º 3
0
def test_parse_line_without_line():
    doc = Document(DOC_URI, DOC_TYPE_ERR)
    diag = plugin.parse_line(TEST_LINE_WITHOUT_LINE, doc)
    assert diag['message'] == '"Request" has no attribute "id"'
    assert diag['range']['start'] == {'line': 0, 'character': 0}
    assert diag['range']['end'] == {'line': 0, 'character': 1}
Exemplo n.º 4
0
def test_parse_full_line():
    diag = plugin.parse_line(TEST_LINE)
    assert diag['message'] == '"Request" has no attribute "id"'
    assert diag['range']['start'] == {'line': 278, 'character': 8}
    assert diag['range']['end'] == {'line': 278, 'character': 9}
Exemplo n.º 5
0
def test_parse_full_line():
    doc = Document(DOC_URI, DOC_TYPE_ERR)
    diag = plugin.parse_line(TEST_LINE, doc)
    assert diag['message'] == '"Request" has no attribute "id"'
    assert diag['range']['start'] == {'line': 278, 'character': 7}
    assert diag['range']['end'] == {'line': 278, 'character': 8}