This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: testAssertEqualSingleLine gives poor errors
Type: Stage: resolved
Components: Versions:
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, michael.foord, python-dev, rbcollins
Priority: normal Keywords: patch

Created on 2014-10-29 02:24 by rbcollins, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
issue22756.patch rbcollins, 2014-10-29 02:30 review
Messages (3)
msg230194 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2014-10-29 02:24
found while backporting unittest fixes.

The current test fails like so:
FAIL: testAssertEqualSingleLine (unittest2.test.test_case.Test_TestCase)
Traceback (most recent call last):
  File "/home/robertc/work/unittest2.hg/unittest2/test/", line 1014, in testAssertEqualSingleLine
    self.assertEqual(sample_text, revised_sample_text)
AssertionError: 'laden swallows fly slowly' != 'unladen swallows fly quickly'
- laden swallows fly slowly?                    ^^^^
+ unladen swallows fly quickly? ++                   ^^^^^

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/robertc/work/unittest2.hg/unittest2/test/", line 1017, in testAssertEqualSingleLine
    self.assertTrue(sample_text_error == error)
AssertionError: False is not true

-> it shouldn't be using assertTrue.
msg230195 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2014-10-29 02:27
There's comments in the test above about 'not testing ourself with ourselves' - but we're testing the rendering of an error case, so its entirely legitimate to use the same method's success path to check equality.
msg230233 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-10-29 19:23
New changeset 2f17d71ec53f by Robert Collins in branch 'default':
Close #22756: Improve the test output for some assertEqual tests.
Date User Action Args
2022-04-11 14:58:09adminsetgithub: 66945
2014-10-29 19:23:15python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg230233

resolution: fixed
stage: resolved
2014-10-29 06:15:52berker.peksagsetnosy: + ezio.melotti, michael.foord
2014-10-29 02:30:38rbcollinssetfiles: + issue22756.patch
keywords: + patch
2014-10-29 02:27:08rbcollinssetmessages: + msg230195
2014-10-29 02:24:57rbcollinscreate