Skip to content

Commit 48087fd

Browse files
[truncate explanation] Simplification of the '...' adding mechanism
1 parent f27a339 commit 48087fd

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/_pytest/assertion/truncate.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,8 @@ def _truncate_explanation(
107107
# No truncation happened, so we do not need to add any explanations
108108
return truncated_explanation
109109

110-
if truncated_explanation[-1]:
111-
# Add ellipsis and take into account part-truncated final line
112-
truncated_explanation[-1] = truncated_explanation[-1] + "..."
113-
else:
114-
# Add proper ellipsis when we were able to fit a full line exactly
115-
truncated_explanation[-1] = "..."
110+
# Something was truncated, adding '...' at the end to show that
111+
truncated_explanation[-1] += "..."
116112
truncated_line_count = (
117113
len(input_lines) - len(truncated_explanation) + int(truncated_char)
118114
)

0 commit comments

Comments
 (0)