derwiki-adroll / mock

Automatically exported from code.google.com/p/mock
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Make call assertion errors align visually #239

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I propose a change to the way call assertion errors are printed. As they are 
printed now, they are some 10 columns away from each other, making it difficult 
to apply visual pattern matching to find errors. With a slight tweak, the calls 
can be visually aligned, making it a thousand times easier to actually find the 
differing part of the arguments.

This is done by changing the message so that the call signatures are on 
separate rows and start on the very same column. To save space and to make the 
message independent on test runners (I thought maybe not all reporters print 
"AssertionError: " before the test failure; they might do it differently).

The change is on line 814 (first line of _format_mock_failure_message):
message = 'Call comparison failed.\nExpected: %s\n  Actual: %s'

Screenshot for glory: http://shot.ninjaloot.se/20141003.183453.png

This was made on the version currently on PyPi - 1.0.1.
Thanks for your time!

Original issue reported on code.google.com by thider...@spotify.com on 3 Oct 2014 at 4:38

GoogleCodeExporter commented 9 years ago
I did not properly end one of the sentences, heh.

To save space and to make the message independent on test runners ([...]) I put 
the two calls comparisons on new lines and added a short message on the top.

Original comment by thider...@spotify.com on 3 Oct 2014 at 4:39