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.

Author r.david.murray
Recipients michael.foord, r.david.murray
Date 2010-10-21.12:48:13
SpamBayes Score 4.070941e-07
Marked as misclassified No
Message-id <1287665297.21.0.48545376383.issue10164@psf.upfronthosting.co.za>
In-reply-to
Content
Just as with regular strings, when comparing failed output involving bytes strings it is really helpful to have a diff showing which bytes have changed.  The attached patch adds an assertMultiLineEqual method to unittest and uses it for comparing bytes in assertEqual.

The diff output is created by first breaking the byte strings into lines using 'splitlines(True)' just as in assertMultiLineEqual, but then each line is converted to a string using 'repr' before the lines sets are passed to ndiff.  This results in output containing escaped bytes, making it easier to compare the differences in the byte strings.

(NB: this patch is the end result of several attempts to make the unittest output more useful in the email package when testing bytes handling).
History
Date User Action Args
2010-10-21 12:48:17r.david.murraysetrecipients: + r.david.murray, michael.foord
2010-10-21 12:48:17r.david.murraysetmessageid: <1287665297.21.0.48545376383.issue10164@psf.upfronthosting.co.za>
2010-10-21 12:48:15r.david.murraylinkissue10164 messages
2010-10-21 12:48:14r.david.murraycreate