Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_diff_text: use repr with escape characters #6702
_diff_text: use repr with escape characters #6702
Changes from 2 commits
c97c50e
0e153a0
9318b23
079e0f9
989bdd7
5274504
2e81042
2ba59a1
e567e04
3e6c734
3a7c810
48c9061
5f92be8
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused by this change (and others) - do you consider a newline a non-printable/zero-width character? Why? It seems quite confusing to me to see a multi-line output but also
\n
, i.e. with newlines represented twice.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@The-Compiler
Otherwise it will not be visible. Check https://github.com/pytest-dev/pytest/pull/6702/files/9318b236ff35fc6a0734ee91bff2011afb93971a#diff-14ad89cac128f1dd3aaa927c656035b3R1342.
Note: this is for a line (text/str) diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be made smarter though maybe to not show them when not at the end of a line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For illustration, on
master
:On this branch:
Is this what you would prefer @The-Compiler ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On master it has a different order (which I find still wrong - it should be left-to-right, top-to-bottom, with only +/- swapped, but off topic here - maybe therefore edited manually?):
How about?
However, with longer strings it is useful to split them on newlines, of course.
FWIW it always looked a bit strange to me seeing:
(it could also be a space etc)
This could also be triggered via some minimal length (related: blueyed#218, where I split it onto separate lines with a certain length).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I guess explicit is indeed better than implicit in this case. I agree having the
^
marker pointing to "nothing" is odd, and I remember people being confused about that.