mouad <mouad...@gmail.com> added the comment:

I took on consideration the two suggestion that was in the issue and create 
this patch that basically show only until the last character that differ and 
truncate the rest.

I just included one test case, other test case if they should be included (and 
if my solution got accepted :)), should be more *complex* and check using Regex 
the correctness of the assertion message, but here is the output that we can 
see when applying the patch:

>>> tc.assertEqual("x\n" * 40 + "\n", "x\n" * 40 + "\r\n")

'x\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\n...nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\n\n
 [truncated]... != 
'x\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\n...\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\n\r
 [truncated]...
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
  x
- 
+ 


>>> tc.assertEqual('aaaa', 'abbb')

AssertionError: 'aa [truncated]... != 'ab [truncated]...
- aaaa
+ abbb

>>> tc.assertEqual('aaaa', 'bbbb')

AssertionError: 'a [truncated]... != 'b [truncated]...
- aaaa
+ bbbb

>>> tc.assertEqual("x\n" * 80 + "\n", "x\n" * 80 + "\r")

AssertionError: 
'x\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\n...nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\n\n
 [truncated]... != 
'x\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\n...nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\n\r
 [truncated]...

----------
keywords: +patch
nosy: +mouad
Added file: http://bugs.python.org/file22486/issue-12038.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12038>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to