Skip to content

Commit 3be4fa7

Browse files
committed
if line number is not a correct it, sort it to top
1 parent da1aa55 commit 3be4fa7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pytest_mypy/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,13 @@ def remove_empty_lines(lines: List[str]) -> List[str]:
165165
def sorted_by_file_and_line(lines: List[str]) -> List[str]:
166166
def extract_parts_as_tuple(line: str) -> Tuple[str, int, str]:
167167
if len(line.split(':', maxsplit=2)) < 3:
168-
return ('', 0, '')
168+
return '', 0, ''
169169

170170
fname, line_number, contents = line.split(':', maxsplit=2)
171-
return fname, int(line_number), contents
171+
try:
172+
return fname, int(line_number), contents
173+
except ValueError:
174+
return '', 0, ''
172175
return sorted(lines, key=extract_parts_as_tuple)
173176

174177

0 commit comments

Comments
 (0)