home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import sys
- import os
- import unittest
- from cStringIO import StringIO
- from types import ListType
- from email.test.test_email import TestEmailBase
- from test.test_support import TestSkipped
- import email
- from email import __file__ as testfile
- from email.iterators import _structure
-
- def openfile(filename):
- join = join
- dirname = dirname
- abspath = abspath
- import os.path
- path = abspath(join(dirname(testfile), os.pardir, 'moredata', filename))
- return open(path, 'r')
-
-
- try:
- openfile('crispin-torture.txt')
- except IOError:
- raise TestSkipped
-
-
- class TortureBase(TestEmailBase):
-
- def _msgobj(self, filename):
- fp = openfile(filename)
-
- try:
- msg = email.message_from_file(fp)
- finally:
- fp.close()
-
- return msg
-
-
-
- class TestCrispinTorture(TortureBase):
-
- def test_mondo_message(self):
- eq = self.assertEqual
- neq = self.ndiffAssertEqual
- msg = self._msgobj('crispin-torture.txt')
- payload = msg.get_payload()
- eq(type(payload), ListType)
- eq(len(payload), 12)
- eq(msg.preamble, None)
- eq(msg.epilogue, '\n')
- fp = StringIO()
- _structure(msg, fp = fp)
- neq(fp.getvalue(), 'multipart/mixed\n text/plain\n message/rfc822\n multipart/alternative\n text/plain\n multipart/mixed\n text/richtext\n application/andrew-inset\n message/rfc822\n audio/basic\n audio/basic\n image/pbm\n message/rfc822\n multipart/mixed\n multipart/mixed\n text/plain\n audio/x-sun\n multipart/mixed\n image/gif\n image/gif\n application/x-be2\n application/atomicmail\n audio/x-sun\n message/rfc822\n multipart/mixed\n text/plain\n image/pgm\n text/plain\n message/rfc822\n multipart/mixed\n text/plain\n image/pbm\n message/rfc822\n application/postscript\n image/gif\n message/rfc822\n multipart/mixed\n audio/basic\n audio/basic\n message/rfc822\n multipart/mixed\n application/postscript\n text/plain\n message/rfc822\n multipart/mixed\n text/plain\n multipart/parallel\n image/gif\n audio/basic\n application/atomicmail\n message/rfc822\n audio/x-sun\n')
-
-
-
- def _testclasses():
- mod = sys.modules[__name__]
- return _[1]
-
-
- def suite():
- suite = unittest.TestSuite()
- for testclass in _testclasses():
- suite.addTest(unittest.makeSuite(testclass))
-
- return suite
-
-
- def test_main():
- for testclass in _testclasses():
- test_support.run_unittest(testclass)
-
-
- if __name__ == '__main__':
- unittest.main(defaultTest = 'suite')
-
-