if fp is None:
fp = sys.stdout
tab = ' ' * (level * 4)
- print(tab + msg.get_content_type(), end=' ', file=fp)
+ print(tab + msg.get_content_type(), end='', file=fp)
if include_default:
- print('[%s]' % msg.get_default_type(), file=fp)
+ print(' [%s]' % msg.get_default_type(), file=fp)
else:
print(file=fp)
if msg.is_multipart():
if first != second:
sfirst = str(first)
ssecond = str(second)
- diff = difflib.ndiff(sfirst.splitlines(), ssecond.splitlines())
- fp = StringIO()
- print(NL, NL.join(diff), file=fp)
- raise self.failureException, fp.getvalue()
+ diff = difflib.ndiff(sfirst.splitlines(True),
+ ssecond.splitlines(True))
+ raise self.failureException(NL + "".join(diff))
def _msgobj(self, filename):
fp = openfile(findfile(filename))
if first != second:
sfirst = str(first)
ssecond = str(second)
- diff = difflib.ndiff(sfirst.splitlines(), ssecond.splitlines())
- fp = StringIO()
- print(NL, NL.join(diff), file=fp)
- raise self.failureException, fp.getvalue()
+ diff = difflib.ndiff(sfirst.splitlines(True),
+ ssecond.splitlines(True))
+ raise self.failureException(NL + "".join(diff))
def _msgobj(self, filename):
fp = openfile(findfile(filename))