[Python-checkins] python/dist/src/Lib/email/test test_email.py, 1.65, 1.66

bwarsaw at users.sourceforge.net bwarsaw at users.sourceforge.net
Sun Nov 28 01:21:45 CET 2004


Update of /cvsroot/python/python/dist/src/Lib/email/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6103/Lib/email/test

Modified Files:
	test_email.py 
Log Message:
Fix for SF bug #1072623.  When the last line of the input string does not end
in a newline, and it's an end boundary, the FeedParser wasn't recognizing it
as such.  Tweak the regexp to make the ending linesep optional.

For grins, clear self._partial when closing the BufferedSubFile.

Added a test case.



Index: test_email.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- test_email.py	6 Nov 2004 00:04:20 -0000	1.65
+++ test_email.py	28 Nov 2004 00:21:42 -0000	1.66
@@ -1351,6 +1351,20 @@
         eq(msg.get_boundary(), '    XXXX')
         eq(len(msg.get_payload()), 2)
 
+    def test_boundary_without_trailing_newline(self):
+        m = Parser().parsestr("""\
+Content-Type: multipart/mixed; boundary="===============0012394164=="
+MIME-Version: 1.0
+
+--===============0012394164==
+Content-Type: image/file1.jpg
+MIME-Version: 1.0
+Content-Transfer-Encoding: base64
+
+YXNkZg==
+--===============0012394164==--""")
+        self.assertEquals(m.get_payload(0).get_payload(), 'YXNkZg==')
+
 
 
 # Test some badly formatted messages



More information about the Python-checkins mailing list