File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 2020 (?:\s\s\[(?P<category>[a-z-]+)\])?
2121 \s*
2222""" , re .VERBOSE | re .MULTILINE )
23+ REX_LINE = re .compile (r"""
24+ (?P<path>.+\.pyi?):
25+ (?P<lineno>[0-9]+):(?:[0-9]+:)?\s
26+ (?P<severity>[a-z]+):\s
27+ (?P<message>.+?)
28+ (?:\s\s\[(?P<category>[a-z-]+)\])?
29+ \s*
30+ """ , re .VERBOSE | re .MULTILINE )
2331REX_LINE_NBQA = re .compile (r"""
2432 (?P<path>.+\.ipynb:cell_[0-9]+):
2533 (?P<lineno>[0-9]+):\s
Original file line number Diff line number Diff line change @@ -46,3 +46,18 @@ def test_line3_parse():
4646 assert e .message == 'This violates the Liskov substitution principle'
4747 assert e .category == 'note'
4848 assert e .get_clean_line (Config ()) == LINE3EXP
49+
50+ # --show-column-numbers files
51+ LINE4 = 'my_project/api/views.py:10:42: note: This violates the Liskov substitution principle\r \n ' # noqa
52+ LINE4EXP = 'my_project/api/views.py:0: note: This violates the Liskov substitution principle' # noqa
53+
54+
55+ def test_line4_parse ():
56+ e = Error .new (LINE4 )
57+ assert e is not None
58+ assert e .path .parts == ('my_project' , 'api' , 'views.py' )
59+ assert e .line_number == 10
60+ assert e .severity == 'note'
61+ assert e .message == 'This violates the Liskov substitution principle'
62+ assert e .category == 'note'
63+ assert e .get_clean_line (Config ()) == LINE4EXP
You can’t perform that action at this time.
0 commit comments