本文整理汇总了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')