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
Updated diff to show \t in string comparison assertions #10961
base: main
Are you sure you want to change the base?
Conversation
…to whitespace/dev
result = '''spam bacon | ||
eggs love''' | ||
desired = "spam bacon eggs love" | ||
assert result == desired | ||
""", | ||
""" | ||
> assert result == desired | ||
E AssertionError: assert 'spam bacon\\n eggs love' == 'spam bacon eggs love' | ||
E - spam bacon eggs love | ||
E + spam\\tbacon | ||
E + \\teggs love |
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.
This looks wrong to me - there are no tab characters in the original strings, so we're actually lying about the contents by replacing four spaces!
I think we need a different approach, perhaps showing the repr
of the explanation lines in question if they differ in their trailing whitespace; or maybe only showing that for the trailing whitespace in question. Check out what the short summary does I guess?
Closes #10704
Added "\t" characters to the diff message, did not add "\n" because the diff already creates each line on a separate line and it shows in the "AssertionError: ______" section of the error message.
Updated test suite to reflect this change.
Before:
After:
Worked with @egwetzel on this issue in team with @HSamiul.