New submission from R. David Murray <rdmur...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue9174>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to