Kaydet (Commit) 9b885043 authored tarafından Guido van Rossum's avatar Guido van Rossum

Fairly subtle fix for failing tests.

üst 8df511b5
...@@ -63,9 +63,9 @@ def _structure(msg, fp=None, level=0, include_default=False): ...@@ -63,9 +63,9 @@ def _structure(msg, fp=None, level=0, include_default=False):
if fp is None: if fp is None:
fp = sys.stdout fp = sys.stdout
tab = ' ' * (level * 4) tab = ' ' * (level * 4)
print(tab + msg.get_content_type(), end=' ', file=fp) print(tab + msg.get_content_type(), end='', file=fp)
if include_default: if include_default:
print('[%s]' % msg.get_default_type(), file=fp) print(' [%s]' % msg.get_default_type(), file=fp)
else: else:
print(file=fp) print(file=fp)
if msg.is_multipart(): if msg.is_multipart():
......
...@@ -54,10 +54,9 @@ class TestEmailBase(unittest.TestCase): ...@@ -54,10 +54,9 @@ class TestEmailBase(unittest.TestCase):
if first != second: if first != second:
sfirst = str(first) sfirst = str(first)
ssecond = str(second) ssecond = str(second)
diff = difflib.ndiff(sfirst.splitlines(), ssecond.splitlines()) diff = difflib.ndiff(sfirst.splitlines(True),
fp = StringIO() ssecond.splitlines(True))
print(NL, NL.join(diff), file=fp) raise self.failureException(NL + "".join(diff))
raise self.failureException, fp.getvalue()
def _msgobj(self, filename): def _msgobj(self, filename):
fp = openfile(findfile(filename)) fp = openfile(findfile(filename))
......
...@@ -55,10 +55,9 @@ class TestEmailBase(unittest.TestCase): ...@@ -55,10 +55,9 @@ class TestEmailBase(unittest.TestCase):
if first != second: if first != second:
sfirst = str(first) sfirst = str(first)
ssecond = str(second) ssecond = str(second)
diff = difflib.ndiff(sfirst.splitlines(), ssecond.splitlines()) diff = difflib.ndiff(sfirst.splitlines(True),
fp = StringIO() ssecond.splitlines(True))
print(NL, NL.join(diff), file=fp) raise self.failureException(NL + "".join(diff))
raise self.failureException, fp.getvalue()
def _msgobj(self, filename): def _msgobj(self, filename):
fp = openfile(findfile(filename)) fp = openfile(findfile(filename))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment