本文整理匯總了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
示例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',
])
示例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
示例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)
示例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')