-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Closed
blueyed
wants to merge
13
commits into
pytest-dev:master
from
blueyed:diff-text-repr-escape-upstream
Closed
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c97c50e
_diff_text: use repr with escape characters
blueyed 0e153a0
fixup! _diff_text: use repr with escape characters
blueyed 9318b23
raw strings, zero-width, note
blueyed 079e0f9
test_reprcompare_zerowidth_and_non_printable
blueyed 989bdd7
simplify itertools.chain.from_iterable
blueyed 5274504
remove zero-width
blueyed 2e81042
handle different line-endings
blueyed 2ba59a1
replace itertools.chain.from_iterable
blueyed e567e04
test_diff_different_line_endings: more coverage
blueyed 3e6c734
revisit, handle more on only one side
blueyed 3a7c810
fix "Avoid deeply nested control flow statements"
blueyed 48c9061
do not repr extra newlines
blueyed 5f92be8
fix max_split
blueyed File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.