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

Michael Foord report at bugs.python.org
Mon Nov 1 04:13:21 CET 2010


Michael Foord <michael at voidspace.org.uk> added the comment:

David - would you get a good approximation of what you want simply with:

    self.assertEqual(ascii(first), ascii(second))

(This actually returns "b'first'" "b'second'" so you may want a convenience function that chops the leading and trailing b'/')

As ascii returns unicode it would automatically delegate to assertMultilineEqual.

The obvious way to hook this up by default for assertEqual is having the split-character as '\n'. This would not be meaningful for using assertEqual to compare bytes that *aren't* text.

----------

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


More information about the Python-bugs-list mailing list