Ezio Melotti added the comment:

Here's a proof of concept to fix the issue (still lacks tests and breaks one 
existing test).

The problem is that assertSequenceEqual computes the diff regardless of the 
size of the sequences, and then truncates it if it's too long.  Producing the 
diff takes time, so checking the size of the sequences and skip the diff if 
they are too long solves the problem.

In the patch I used an hardcoded and arbitrary value of 30 elements -- the 
other attributes like maxDiff and _diffThreshold can't be used here.
The value is so low because if the sequence doesn't fit in one line, the output 
will list one element per line, resulting in 30+ lines of output which is not 
very readable IMHO.  Also note that regardless of the this diff, the error 
message indicates what is the position of the first element that differs.
The threshold value I picked could be moved to a _seqDiffThreshold (and 
possibly _diffThreshold can be renamed to _strDiffThreshold).

This issue is related to #11763.  All other methods should be checked for 
similar issues.

----------
assignee: michael.foord -> ezio.melotti
keywords: +patch
stage: needs patch -> patch review
versions: +Python 2.7
Added file: http://bugs.python.org/file32105/issue19217.diff

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

Reply via email to