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
a
b
c
- d
+ e
Thinking-that-sometimes-a-novice's-expectations-are-relevant-to-such-discussions'ly
yours,
Glenn
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com