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())
def process(stmt): lines = split_unquoted_newlines(stmt) return '\n'.join(line.rstrip() for line in lines)
def process(self, stack, stmt): raw = unicode(stmt) lines = split_unquoted_newlines(raw) res = '\n'.join(line.rstrip() for line in lines) return res
def process(self, stack, stmt): raw = str(stmt) lines = split_unquoted_newlines(raw) res = "\n".join(line.rstrip() for line in lines) return res
def process(stmt): raw = text_type(stmt) lines = split_unquoted_newlines(raw) return '\n'.join(line.rstrip() for line in lines)