[Python-checkins]
python/dist/src/Lib/email/test test_email.py, 1.56, 1.57
bwarsaw at users.sourceforge.net
bwarsaw at users.sourceforge.net
Thu May 13 16:15:29 EDT 2004
Update of /cvsroot/python/python/dist/src/Lib/email/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2760
Modified Files:
test_email.py
Log Message:
test_nested_inner_contains_outer_boundary(), test_nested_with_same_boundary():
Two evil samples from Anthony's MIME torture tests.
Index: test_email.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** test_email.py 11 May 2004 22:21:56 -0000 1.56
--- test_email.py 13 May 2004 20:15:20 -0000 1.57
***************
*** 1326,1329 ****
--- 1326,1365 ----
self.assertEqual(len(msg.get_payload()), 3)
+ def test_nested_inner_contains_outer_boundary(self):
+ eq = self.ndiffAssertEqual
+ # msg_38.txt has an inner part that contains outer boundaries. My
+ # interpretation of RFC 2046 (based on sections 5.1 and 5.1.2) say
+ # these are illegal and should be interpreted as unterminated inner
+ # parts.
+ msg = self._msgobj('msg_38.txt')
+ sfp = StringIO()
+ Iterators._structure(msg, sfp)
+ eq(sfp.getvalue(), """\
+ multipart/mixed
+ multipart/mixed
+ multipart/alternative
+ text/plain
+ text/plain
+ text/plain
+ text/plain
+ """)
+
+ def test_nested_with_same_boundary(self):
+ eq = self.ndiffAssertEqual
+ # msg 39.txt is similarly evil in that it's got inner parts that use
+ # the same boundary as outer parts. Again, I believe the way this is
+ # parsed is closest to the spirit of RFC 2046
+ msg = self._msgobj('msg_39.txt')
+ sfp = StringIO()
+ Iterators._structure(msg, sfp)
+ eq(sfp.getvalue(), """\
+ multipart/mixed
+ multipart/mixed
+ multipart/alternative
+ application/octet-stream
+ application/octet-stream
+ text/plain
+ """)
+
More information about the Python-checkins
mailing list