Skip to content

Commit cdaad89

Browse files
committed
Add a test for parsing non error lines
1 parent 562cbba commit cdaad89

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/test_plugin.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
TYPE_ERR_MSG = '"Dict[<nothing>, <nothing>]" has no attribute "append"'
2121

2222
TEST_LINE = 'test_plugin.py:279:8:279:16: error: "Request" has no attribute "id" [attr-defined]'
23+
TEST_LINE_NOTE = (
24+
'test_plugin.py:124:1:129:77: note: Use "-> None" if function does not return a value'
25+
)
2326

2427
windows_flag: Dict[str, int] = (
2528
{"creationflags": subprocess.CREATE_NO_WINDOW} if os.name == "nt" else {} # type: ignore
@@ -82,6 +85,15 @@ def test_parse_full_line(workspace):
8285
assert diag["code"] == "attr-defined"
8386

8487

88+
def test_parse_note_line(workspace):
89+
diag = plugin.parse_line(TEST_LINE_NOTE)
90+
assert diag["message"] == 'Use "-> None" if function does not return a value'
91+
assert diag["range"]["start"] == {"line": 123, "character": 0}
92+
assert diag["range"]["end"] == {"line": 128, "character": 77}
93+
assert diag["severity"] == 3
94+
assert diag["code"] == None
95+
96+
8597
def test_multiple_workspaces(tmpdir, last_diagnostics_monkeypatch):
8698
DOC_SOURCE = """
8799
def foo():

0 commit comments

Comments
 (0)