當前位置: 首頁>>代碼示例>>Python>>正文


Python MIMEAudio.MIMEAudio方法代碼示例

本文整理匯總了Python中email.MIMEAudio.MIMEAudio方法的典型用法代碼示例。如果您正苦於以下問題:Python MIMEAudio.MIMEAudio方法的具體用法?Python MIMEAudio.MIMEAudio怎麽用?Python MIMEAudio.MIMEAudio使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在email.MIMEAudio的用法示例。


在下文中一共展示了MIMEAudio.MIMEAudio方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_mangle_from_in_preamble_and_epilog

# 需要導入模塊: from email import MIMEAudio [as 別名]
# 或者: from email.MIMEAudio import MIMEAudio [as 別名]
def test_mangle_from_in_preamble_and_epilog(self):
        s = StringIO()
        g = Generator(s, mangle_from_=True)
        msg = email.message_from_string(textwrap.dedent("""\
            From: [email protected]
            Mime-Version: 1.0
            Content-Type: multipart/mixed; boundary=XXX

            From somewhere unknown

            --XXX
            Content-Type: text/plain

            foo

            --XXX--

            From somewhere unknowable
            """))
        g.flatten(msg)
        self.assertEqual(len([1 for x in s.getvalue().split('\n')
                                  if x.startswith('>From ')]), 2)


# Test the basic MIMEAudio class 
開發者ID:adde88,項目名稱:hostapd-mana,代碼行數:27,代碼來源:test_email.py

示例2: test__all__

# 需要導入模塊: from email import MIMEAudio [as 別名]
# 或者: from email.MIMEAudio import MIMEAudio [as 別名]
def test__all__(self):
        module = __import__('email')
        all = module.__all__
        all.sort()
        self.assertEqual(all, [
            # Old names
            'Charset', 'Encoders', 'Errors', 'Generator',
            'Header', 'Iterators', 'MIMEAudio', 'MIMEBase',
            'MIMEImage', 'MIMEMessage', 'MIMEMultipart',
            'MIMENonMultipart', 'MIMEText', 'Message',
            'Parser', 'Utils', 'base64MIME',
            # new names
            'base64mime', 'charset', 'encoders', 'errors', 'generator',
            'header', 'iterators', 'message', 'message_from_file',
            'message_from_string', 'mime', 'parser',
            'quopriMIME', 'quoprimime', 'utils',
            ]) 
開發者ID:adde88,項目名稱:hostapd-mana,代碼行數:19,代碼來源:test_email.py

示例3: test_dont_mangle_from

# 需要導入模塊: from email import MIMEAudio [as 別名]
# 或者: from email.MIMEAudio import MIMEAudio [as 別名]
def test_dont_mangle_from(self):
        s = StringIO()
        g = Generator(s, mangle_from_=False)
        g.flatten(self.msg)
        self.assertEqual(s.getvalue(), """\
From: [email protected]

From the desk of A.A.A.:
Blah blah blah
""")



# Test the basic MIMEAudio class 
開發者ID:sugarguo,項目名稱:Flask_Blog,代碼行數:16,代碼來源:test_email.py

示例4: setUp

# 需要導入模塊: from email import MIMEAudio [as 別名]
# 或者: from email.MIMEAudio import MIMEAudio [as 別名]
def setUp(self):
        # Make sure we pick up the audiotest.au that lives in email/test/data.
        # In Python, there's an audiotest.au living in Lib/test but that isn't
        # included in some binary distros that don't include the test
        # package.  The trailing empty string on the .join() is significant
        # since findfile() will do a dirname().
        datadir = os.path.join(os.path.dirname(landmark), 'data', '')
        fp = open(findfile('audiotest.au', datadir), 'rb')
        try:
            self._audiodata = fp.read()
        finally:
            fp.close()
        self._au = MIMEAudio(self._audiodata) 
開發者ID:sugarguo,項目名稱:Flask_Blog,代碼行數:15,代碼來源:test_email.py

示例5: test_checkSetMinor

# 需要導入模塊: from email import MIMEAudio [as 別名]
# 或者: from email.MIMEAudio import MIMEAudio [as 別名]
def test_checkSetMinor(self):
        au = MIMEAudio(self._audiodata, 'fish')
        self.assertEqual(au.get_content_type(), 'audio/fish') 
開發者ID:sugarguo,項目名稱:Flask_Blog,代碼行數:5,代碼來源:test_email.py


注:本文中的email.MIMEAudio.MIMEAudio方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。