[Python-Dev] r87389 - in python/branches/py3k: Doc/library/unittest.rst Lib/unittest/case.py Misc/NEWS

Glenn Linderman v+python at g.nevcal.com
Mon Dec 20 21:41:04 CET 2010

On 12/20/2010 6:31 AM, Antoine Pitrou wrote:
>> >  Diffing is completely an implementation detail of how the failure
>> >  messages are generated. The important thing is that failure messages
>> >  make sense with respect to actual result and expected result.
> Which, again, they don't. Let's see:
>      self.assertEqual(actual, expected)
> AssertionError: 'a\nb\nc\ne\n' != 'a\nb\nc\nd\n'
>    a
>    b
>    c
> - e
> + d
> The diff shows "expected - actual", but it would be logical (in your own
> logic) to display "actual - expected". The whole issue disappears if you
> drop this idea of naming the arguments "actual" and "expected".

I'm not a unittest user, although I probably will become one, in time, 
when I learn enough to contribute to Python, instead of just find bugs 
in it from use.

I don't much care what the parameters names are, although the terms 
actual and expected seem good for testing scenarios if properly used, 
but the above does not match what I would expect the behavior to be from 
a testing scenario: run the test, and tell me what changed from the 
expected results.

If the expected result (not parameter) is d and the actual result (not 
parameter) is e, the diff should show

- d
+ e


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20101220/daeed91d/attachment.html>

More information about the Python-Dev mailing list