示例#1
0
    def ndiffAssertEqual(self, first, second):
        """Like failUnlessEqual except use ndiff for readable output."""
        if first != second:
            # Using the built-in .splitlines() method here will cause incorrect
            # results when splitting statements that have quoted CR/CR+LF
            # characters.
            sfirst = split_unquoted_newlines(u(first))
            ssecond = split_unquoted_newlines(u(second))
            diff = difflib.ndiff(sfirst, ssecond)

            fp = StringIO()
            fp.write('\n')
            fp.write('\n'.join(diff))

            raise self.failureException(fp.getvalue())
示例#2
0
    def ndiffAssertEqual(self, first, second):
        """Like failUnlessEqual except use ndiff for readable output."""
        if first != second:
            # Using the built-in .splitlines() method here will cause incorrect
            # results when splitting statements that have quoted CR/CR+LF
            # characters.
            sfirst = split_unquoted_newlines(u(first))
            ssecond = split_unquoted_newlines(u(second))
            diff = difflib.ndiff(sfirst, ssecond)

            fp = StringIO()
            fp.write('\n')
            fp.write('\n'.join(diff))

            raise self.failureException(fp.getvalue())
示例#3
0
 def process(stmt):
     lines = split_unquoted_newlines(stmt)
     return '\n'.join(line.rstrip() for line in lines)
示例#4
0
 def process(self, stack, stmt):
     raw = unicode(stmt)
     lines = split_unquoted_newlines(raw)
     res = '\n'.join(line.rstrip() for line in lines)
     return res
示例#5
0
 def process(stmt):
     lines = split_unquoted_newlines(stmt)
     return '\n'.join(line.rstrip() for line in lines)
示例#6
0
 def process(self, stack, stmt):
     raw = str(stmt)
     lines = split_unquoted_newlines(raw)
     res = "\n".join(line.rstrip() for line in lines)
     return res
示例#7
0
 def process(self, stack, stmt):
     raw = unicode(stmt)
     lines = split_unquoted_newlines(raw)
     res = '\n'.join(line.rstrip() for line in lines)
     return res
示例#8
0
 def process(stmt):
     raw = text_type(stmt)
     lines = split_unquoted_newlines(raw)
     return '\n'.join(line.rstrip() for line in lines)