Fairly subtle fix for failing tests.

This commit is contained in:
Guido van Rossum 2007-02-09 22:36:02 +00:00
parent 8df511b5f6
commit 9b8850439c
3 changed files with 8 additions and 10 deletions

View File

@ -63,9 +63,9 @@ def _structure(msg, fp=None, level=0, include_default=False):
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():

View File

@ -54,10 +54,9 @@ class TestEmailBase(unittest.TestCase):
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))

View File

@ -55,10 +55,9 @@ class TestEmailBase(unittest.TestCase):
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))