1818"""
1919TYPE_ERR_MSG = '"Dict[<nothing>, <nothing>]" has no attribute "append" [attr-defined]'
2020
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"'
2223TEST_LINE_WITHOUT_COL = "test_plugin.py:279: " 'error: "Request" has no attribute "id"'
2324TEST_LINE_WITHOUT_LINE = "test_plugin.py: " 'error: "Request" has no attribute "id"'
2425
@@ -65,14 +66,22 @@ def test_plugin(workspace, last_diagnostics_monkeypatch):
6566 diag = diags [0 ]
6667 assert diag ["message" ] == TYPE_ERR_MSG
6768 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 }
6970
7071
7172def test_parse_full_line (workspace ):
7273 diag = plugin .parse_line (TEST_LINE ) # TODO parse a document here
7374 assert diag ["message" ] == '"Request" has no attribute "id"'
7475 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 }
7685
7786
7887def test_parse_line_without_col (workspace ):
@@ -95,7 +104,7 @@ def test_parse_line_without_line(workspace):
95104def test_parse_line_with_context (monkeypatch , word , bounds , workspace ):
96105 doc = Document (DOC_URI , workspace )
97106 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 )
99108 assert diag ["message" ] == '"Request" has no attribute "id"'
100109 assert diag ["range" ]["start" ] == {"line" : 278 , "character" : bounds [0 ]}
101110 assert diag ["range" ]["end" ] == {"line" : 278 , "character" : bounds [1 ]}
@@ -226,7 +235,7 @@ def test_option_overrides_dmypy(last_diagnostics_monkeypatch, workspace):
226235 "--" ,
227236 "--python-executable" ,
228237 "/tmp/fake" ,
229- "--show-column-numbers " ,
238+ "--show-error-end " ,
230239 document .path ,
231240 ]
232241 m .assert_called_with (expected , capture_output = True , ** windows_flag , encoding = "utf-8" )
0 commit comments