def assertSequenceEqual(self, seq1, seq2,<EOL>msg=None, seq_type=None, max_diff=<NUM_LIT>*<NUM_LIT:8>):
if seq_type is not None:<EOL><INDENT>seq_type_name = seq_type.__name__<EOL>if not isinstance(seq1, seq_type):<EOL><INDENT>raise self.failureException('<STR_LIT>'<EOL>% (seq_type_name, safe_repr(seq1)))<EOL><DEDENT>if not isinstance(seq2, seq_type):<EOL><INDENT>raise self.failureException('<STR_LIT>'<EOL>% (seq_type_name, safe_repr(seq2)))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>seq_type_name = "<STR_LIT>"<EOL><DEDENT>differing = None<EOL>try:<EOL><INDENT>len1 = len(seq1)<EOL><DEDENT>except (TypeError, NotImplementedError):<EOL><INDENT>differing = '<STR_LIT>' % (<EOL>seq_type_name)<EOL><DEDENT>if differing is None:<EOL><INDENT>try:<EOL><INDENT>len2 = len(seq2)<EOL><DEDENT>except (TypeError, NotImplementedError):<EOL><INDENT>differing = '<STR_LIT>' % (<EOL>seq_type_name)<EOL><DEDENT><DEDENT>if differing is None:<EOL><INDENT>if seq1 == seq2:<EOL><INDENT>return<EOL><DEDENT>seq1_repr = repr(seq1)<EOL>seq2_repr = repr(seq2)<EOL>if len(seq1_repr) > <NUM_LIT:30>:<EOL><INDENT>seq1_repr = seq1_repr[:<NUM_LIT:30>] + '<STR_LIT>'<EOL><DEDENT>if len(seq2_repr) > <NUM_LIT:30>:<EOL><INDENT>seq2_repr = seq2_repr[:<NUM_LIT:30>] + '<STR_LIT>'<EOL><DEDENT>elements = (seq_type_name.capitalize(), seq1_repr, seq2_repr)<EOL>differing = '<STR_LIT>' % elements<EOL>for i in range(min(len1, len2)):<EOL><INDENT>try:<EOL><INDENT>item1 = seq1[i]<EOL><DEDENT>except (TypeError, IndexError, NotImplementedError):<EOL><INDENT>differing += ('<STR_LIT>' %<EOL>(i, seq_type_name))<EOL>break<EOL><DEDENT>try:<EOL><INDENT>item2 = seq2[i]<EOL><DEDENT>except (TypeError, IndexError, NotImplementedError):<EOL><INDENT>differing += ('<STR_LIT>' %<EOL>(i, seq_type_name))<EOL>break<EOL><DEDENT>if item1 != item2:<EOL><INDENT>differing += ('<STR_LIT>' %<EOL>(i, item1, item2))<EOL>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if (len1 == len2 and seq_type is None and<EOL>type(seq1) != type(seq2)):<EOL><INDENT>return<EOL><DEDENT><DEDENT>if len1 > len2:<EOL><INDENT>differing += ('<STR_LIT>'<EOL>'<STR_LIT>' % (seq_type_name, len1 - len2))<EOL>try:<EOL><INDENT>differing += ('<STR_LIT>' %<EOL>(len2, seq1[len2]))<EOL><DEDENT>except (TypeError, IndexError, NotImplementedError):<EOL><INDENT>differing += ('<STR_LIT>'<EOL>'<STR_LIT>' % (len2, seq_type_name))<EOL><DEDENT><DEDENT>elif len1 < len2:<EOL><INDENT>differing += ('<STR_LIT>'<EOL>'<STR_LIT>' % (seq_type_name, len2 - len1))<EOL>try:<EOL><INDENT>differing += ('<STR_LIT>' %<EOL>(len1, seq2[len1]))<EOL><DEDENT>except (TypeError, IndexError, NotImplementedError):<EOL><INDENT>differing += ('<STR_LIT>'<EOL>'<STR_LIT>' % (len1, seq_type_name))<EOL><DEDENT><DEDENT><DEDENT>standardMsg = differing<EOL>diffMsg = '<STR_LIT:\n>' + '<STR_LIT:\n>'.join(<EOL>difflib.ndiff(pprint.pformat(seq1).splitlines(),<EOL>pprint.pformat(seq2).splitlines()))<EOL>standardMsg = self._truncateMessage(standardMsg, diffMsg)<EOL>msg = self._formatMessage(msg, standardMsg)<EOL>self.fail(msg)<EOL>
An equality assertion for ordered sequences (like lists and tuples).

        For the purposes of this function, a valid ordered sequence type is one
        which can be indexed, has a length, and has an equality operator.

        Args:
            seq1: The first sequence to compare.
            seq2: The second sequence to compare.
            seq_type: The expected datatype of the sequences, or None if no
                    datatype should be enforced.
            msg: Optional message to use on failure instead of a list of
                    differences.
            max_diff: Maximum size off the diff, larger diffs are not shown