18
18
"""
19
19
TYPE_ERR_MSG = '"Dict[<nothing>, <nothing>]" has no attribute "append" [attr-defined]'
20
20
21
- TEST_LINE = 'test_plugin.py:279:8: error: "Request" has no attribute "id"'
21
+ TEST_LINE = 'test_plugin.py:279:8:279:19: error: "Request" has no attribute "id"'
22
+ TEST_LINE_WITHOUT_END = 'test_plugin.py:279:8: error: "Request" has no attribute "id"'
22
23
TEST_LINE_WITHOUT_COL = "test_plugin.py:279: " 'error: "Request" has no attribute "id"'
23
24
TEST_LINE_WITHOUT_LINE = "test_plugin.py: " 'error: "Request" has no attribute "id"'
24
25
@@ -65,14 +66,22 @@ def test_plugin(workspace, last_diagnostics_monkeypatch):
65
66
diag = diags [0 ]
66
67
assert diag ["message" ] == TYPE_ERR_MSG
67
68
assert diag ["range" ]["start" ] == {"line" : 0 , "character" : 0 }
68
- assert diag ["range" ]["end" ] == {"line" : 0 , "character" : 1 }
69
+ assert diag ["range" ]["end" ] == {"line" : 0 , "character" : 8 }
69
70
70
71
71
72
def test_parse_full_line (workspace ):
72
73
diag = plugin .parse_line (TEST_LINE ) # TODO parse a document here
73
74
assert diag ["message" ] == '"Request" has no attribute "id"'
74
75
assert diag ["range" ]["start" ] == {"line" : 278 , "character" : 7 }
75
- assert diag ["range" ]["end" ] == {"line" : 278 , "character" : 8 }
76
+ assert diag ["range" ]["end" ] == {"line" : 278 , "character" : 18 }
77
+
78
+
79
+ def test_parse_line_without_end (workspace ):
80
+ doc = Document (DOC_URI , workspace )
81
+ diag = plugin .parse_line (TEST_LINE_WITHOUT_END , doc )
82
+ assert diag ["message" ] == '"Request" has no attribute "id"'
83
+ assert diag ["range" ]["start" ] == {"line" : 278 , "character" : 7 }
84
+ assert diag ["range" ]["end" ] == {"line" : 278 , "character" : 13 }
76
85
77
86
78
87
def test_parse_line_without_col (workspace ):
@@ -95,7 +104,7 @@ def test_parse_line_without_line(workspace):
95
104
def test_parse_line_with_context (monkeypatch , word , bounds , workspace ):
96
105
doc = Document (DOC_URI , workspace )
97
106
monkeypatch .setattr (Document , "word_at_position" , lambda * args : word )
98
- diag = plugin .parse_line (TEST_LINE , doc )
107
+ diag = plugin .parse_line (TEST_LINE_WITHOUT_END , doc )
99
108
assert diag ["message" ] == '"Request" has no attribute "id"'
100
109
assert diag ["range" ]["start" ] == {"line" : 278 , "character" : bounds [0 ]}
101
110
assert diag ["range" ]["end" ] == {"line" : 278 , "character" : bounds [1 ]}
@@ -226,7 +235,7 @@ def test_option_overrides_dmypy(last_diagnostics_monkeypatch, workspace):
226
235
"--" ,
227
236
"--python-executable" ,
228
237
"/tmp/fake" ,
229
- "--show-column-numbers " ,
238
+ "--show-error-end " ,
230
239
document .path ,
231
240
]
232
241
m .assert_called_with (expected , capture_output = True , ** windows_flag , encoding = "utf-8" )
0 commit comments