[issue10164] Add an assertBytesEqual to unittest and use it for bytes assertEqual

Raymond Hettinger report at bugs.python.org
Sun Oct 31 04:45:09 CET 2010


Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

Am discussing this with the OP on IRC and tabling it for a while so we can better think out the API.

The goal is to let assertEqual(a, b) do straight-comparions of raw bytes, but to give a nice looking diff (possibly translated with line breaks or somesuch) when the test fails.  This will be helpful in testing the email module. 

The current patch requires that assertBytesEqual be exposed and called directly so that a user can specify a split-at argument.  The purpose of that argument is to approximate the line breaking that occurs naturally in text.  The OP does not want to decode the bytes prior to the equality test, but does want a readable diff whenever the bytes represent ascii text.

----------
resolution:  -> later

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10164>
_______________________________________


More information about the Python-bugs-list mailing list