From 4710c53dcad1ebf3755f3efb9e80ac24bd72a9b2 Mon Sep 17 00:00:00 2001 From: darylm503 Date: Mon, 16 Apr 2012 22:12:42 +0000 Subject: AppPkg/Applications/Python: Add Python 2.7.2 sources since the release of Python 2.7.3 made them unavailable from the python.org web site. These files are a subset of the python-2.7.2.tgz distribution from python.org. Changed files from PyMod-2.7.2 have been copied into the corresponding directories of this tree, replacing the original files in the distribution. Signed-off-by: daryl.mcdaniel@intel.com git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13197 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Python/Python-2.7.2/Lib/test/test_multifile.py | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_multifile.py (limited to 'AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_multifile.py') diff --git a/AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_multifile.py b/AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_multifile.py new file mode 100644 index 0000000000..b5f63ee015 --- /dev/null +++ b/AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_multifile.py @@ -0,0 +1,67 @@ +from test import test_support +mimetools = test_support.import_module('mimetools', deprecated=True) +multifile = test_support.import_module('multifile', deprecated=True) +import cStringIO + +msg = """Mime-Version: 1.0 +Content-Type: multipart/mixed; + boundary="=====================_590453667==_" +X-OriginalArrivalTime: 05 Feb 2002 03:43:23.0310 (UTC) FILETIME=[42D88CE0:01C1ADF7] + +--=====================_590453667==_ +Content-Type: multipart/alternative; + boundary="=====================_590453677==_.ALT" + +--=====================_590453677==_.ALT +Content-Type: text/plain; charset="us-ascii"; format=flowed + +test A +--=====================_590453677==_.ALT +Content-Type: text/html; charset="us-ascii" + + +test B + +--=====================_590453677==_.ALT-- + +--=====================_590453667==_ +Content-Type: text/plain; charset="us-ascii" +Content-Disposition: attachment; filename="att.txt" + +Attached Content. +Attached Content. +Attached Content. +Attached Content. + +--=====================_590453667==_-- + +""" + +def getMIMEMsg(mf): + global boundaries, linecount + msg = mimetools.Message(mf) + + #print "TYPE: %s" % msg.gettype() + if msg.getmaintype() == 'multipart': + boundary = msg.getparam("boundary") + boundaries += 1 + + mf.push(boundary) + while mf.next(): + getMIMEMsg(mf) + mf.pop() + else: + lines = mf.readlines() + linecount += len(lines) + +def test_main(): + global boundaries, linecount + boundaries = 0 + linecount = 0 + f = cStringIO.StringIO(msg) + getMIMEMsg(multifile.MultiFile(f)) + assert boundaries == 2 + assert linecount == 9 + +if __name__ == '__main__': + test_main() -- cgit v1.2.3