+++ /dev/null
-from test import test_support\r
-mimetools = test_support.import_module('mimetools', deprecated=True)\r
-multifile = test_support.import_module('multifile', deprecated=True)\r
-import cStringIO\r
-\r
-msg = """Mime-Version: 1.0\r
-Content-Type: multipart/mixed;\r
- boundary="=====================_590453667==_"\r
-X-OriginalArrivalTime: 05 Feb 2002 03:43:23.0310 (UTC) FILETIME=[42D88CE0:01C1ADF7]\r
-\r
---=====================_590453667==_\r
-Content-Type: multipart/alternative;\r
- boundary="=====================_590453677==_.ALT"\r
-\r
---=====================_590453677==_.ALT\r
-Content-Type: text/plain; charset="us-ascii"; format=flowed\r
-\r
-test A\r
---=====================_590453677==_.ALT\r
-Content-Type: text/html; charset="us-ascii"\r
-\r
-<html>\r
-<b>test B</font></b></html>\r
-\r
---=====================_590453677==_.ALT--\r
-\r
---=====================_590453667==_\r
-Content-Type: text/plain; charset="us-ascii"\r
-Content-Disposition: attachment; filename="att.txt"\r
-\r
-Attached Content.\r
-Attached Content.\r
-Attached Content.\r
-Attached Content.\r
-\r
---=====================_590453667==_--\r
-\r
-"""\r
-\r
-def getMIMEMsg(mf):\r
- global boundaries, linecount\r
- msg = mimetools.Message(mf)\r
-\r
- #print "TYPE: %s" % msg.gettype()\r
- if msg.getmaintype() == 'multipart':\r
- boundary = msg.getparam("boundary")\r
- boundaries += 1\r
-\r
- mf.push(boundary)\r
- while mf.next():\r
- getMIMEMsg(mf)\r
- mf.pop()\r
- else:\r
- lines = mf.readlines()\r
- linecount += len(lines)\r
-\r
-def test_main():\r
- global boundaries, linecount\r
- boundaries = 0\r
- linecount = 0\r
- f = cStringIO.StringIO(msg)\r
- getMIMEMsg(multifile.MultiFile(f))\r
- assert boundaries == 2\r
- assert linecount == 9\r
-\r
-if __name__ == '__main__':\r
- test_main()\r