[New-bugs-announce] [issue9174] unittest assertEqual error output sub-optimal for single strings

R. David Murray report at bugs.python.org
Tue Jul 6 06:02:17 CEST 2010


New submission from R. David Murray <rdmurray at bitdance.com>:

When assertEqual is called on a pair of strings, then in Python3 assertMultiLineEqual is called.  This function calls ndiff to display a nicely formatted multiline comparison of the strings, which would make it very easy to spot the differences...if it worked.  However, ndiff does not add newlines where they do not exist, so the output is not correctly formatted when strings without newlines are compared.

Attached is a unit test and patch.

This fix should be backported to 2.7, since assertMultiLineEqual is used there for unicode strings.

Assigning to Michael Foord for review.  Michael, you can assign it back to me if you'd like me to commit it.

----------
assignee: michael.foord
components: Library (Lib)
files: unittest_assertEquals.patch
keywords: patch
messages: 109365
nosy: michael.foord, r.david.murray
priority: normal
severity: normal
stage: patch review
status: open
title: unittest assertEqual error output sub-optimal for single strings
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file17879/unittest_assertEquals.patch

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


More information about the New-bugs-announce mailing list