-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Escape whitespace only strings when diffing them on failed assertions #3444
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
Escape whitespace only strings when diffing them on failed assertions #3444
Conversation
3605511
to
dca77b2
Compare
_pytest/assertion/util.py
Outdated
@@ -171,10 +171,22 @@ def _diff_text(left, right, verbose=False): | |||
""" | |||
from difflib import ndiff | |||
explanation = [] | |||
|
|||
def to_unicode_text(binary_text): |
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 believe we should try to make this function name a bit more speaking
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.
That's the best I could come up with by reading the git blame message for the line in question... do you have a suggestion?
If we don't get a better name I think that's not a big deal TBH given that it is a local function, but definitely if we can get an improved name the better.
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.
escape_for_readable_diff
perhaps - its a bit tricky to name this one indeed
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 like it, updated!
Anything else @RonnyPfannschmidt? |
well done 👍 |
Fix #3443
Here's how it looks: