Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-24780: unittest assertEqual difference output foiled by newlines#11548

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

nanjekyejoannah
Copy link
Contributor

@nanjekyejoannahnanjekyejoannah commentedJan 14, 2019
edited
Loading

I have created a fix for this issue and relevant tests.

https://bugs.python.org/issue24780

@@ -1238,6 +1238,11 @@ def assertCountEqual(self, first, second, msg=None):
msg = self._formatMessage(msg, standardMsg)
self.fail(msg)

def addTrailingNewLine(self, line):
if line != '' and (line[-1] != '\n' or line[-1] != ' '):
line = line + '\n'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for the PR.line is a list here and this causes test failures due toTypeError.lines seems to be a better name since it makes me think it's a single line but it's actually a list of lines.

class AssertEqualTest(unittest.TestCase):

def test_trailing_new_line_at_end(self):
self.assertEqual("abc\n", "abc\n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think a better test would be to test the output diff likehttps://github.com/python/cpython/blob/e709c1be97a04156c628f534116a236b9581aa2f/Lib/unittest/test/test_case.py#L1122 and it should be testing the failure cases and asserting the Exception output string.

@nanjekyejoannah
Copy link
ContributorAuthor

@tirkarthi I made the necessary updates to this PR.

@tirkarthi
Copy link
Member

Thanks@nanjekyejoannah, tests should be fixed as noted inhttps://github.com/python/cpython/pull/11548/files#r247392463 . The tests are about the strings being equal and are not related to the issue. The actual tests should be about the diff output for the tests.

@nanjekyejoannah
Copy link
ContributorAuthor

closed this. Someone can open another PR.

@mblahay
Copy link
Contributor

@nanjekyejoannah Why did you close the PR?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tirkarthitirkarthitirkarthi left review comments

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@nanjekyejoannah@tirkarthi@mblahay@the-knights-who-say-ni@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp