]> granicus.if.org Git - python/commitdiff
Fairly subtle fix for failing tests.
authorGuido van Rossum <guido@python.org>
Fri, 9 Feb 2007 22:36:02 +0000 (22:36 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 9 Feb 2007 22:36:02 +0000 (22:36 +0000)
Lib/email/iterators.py
Lib/email/test/test_email.py
Lib/email/test/test_email_renamed.py

index 4f2c84c0994989ddeaa5953fc6727d5934204f04..155e19eace56c0976fc0e032a1b51dee830955e3 100644 (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():
index 0a25a67abb30f6fff529b7088d93e4e9a1c8ef2f..c3269d75811d38287e95b6d8c641bc5eaf8b039a 100644 (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))
index 532b146a04b0d5ed66ca1797b184e4897f47e7a1..21061b072545bfa1b69a570b4ebe3581982b3f55 100644 (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))