当前位置: 首页>>代码示例>>Python>>正文


Python mailbox.MMDFMessage方法代码示例

本文整理汇总了Python中mailbox.MMDFMessage方法的典型用法代码示例。如果您正苦于以下问题:Python mailbox.MMDFMessage方法的具体用法?Python mailbox.MMDFMessage怎么用?Python mailbox.MMDFMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mailbox的用法示例。


在下文中一共展示了mailbox.MMDFMessage方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_babyl_to_mboxmmdf

# 需要导入模块: import mailbox [as 别名]
# 或者: from mailbox import MMDFMessage [as 别名]
def test_babyl_to_mboxmmdf(self):
        # Convert BabylMessage to mboxMessage and MMDFMessage
        pairs = (('unseen', 'O'), ('deleted', 'ROD'), ('filed', 'RO'),
                 ('answered', 'ROA'), ('forwarded', 'RO'), ('edited', 'RO'),
                 ('resent', 'RO'))
        for setting, result in pairs:
            for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
                msg = mailbox.BabylMessage(_sample_message)
                msg.add_label(setting)
                self.assertEqual(class_(msg).get_flags(), result)
        msg = mailbox.BabylMessage(_sample_message)
        for label in ('unseen', 'deleted', 'filed', 'answered', 'forwarded',
                      'edited', 'resent'):
            msg.add_label(label)
        for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
            self.assertEqual(class_(msg).get_flags(), 'ODA') 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:18,代码来源:test_mailbox.py

示例2: test_add_mbox_or_mmdf_message

# 需要导入模块: import mailbox [as 别名]
# 或者: from mailbox import MMDFMessage [as 别名]
def test_add_mbox_or_mmdf_message(self):
        # Add an mboxMessage or MMDFMessage
        for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
            msg = class_('From foo@bar blah\nFrom: foo\n\n0\n')
            key = self._box.add(msg) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:7,代码来源:test_mailbox.py

示例3: test_explain_to

# 需要导入模块: import mailbox [as 别名]
# 或者: from mailbox import MMDFMessage [as 别名]
def test_explain_to(self):
        # Copy self's format-specific data to other message formats.
        # This test is superficial; better ones are in TestMessageConversion.
        msg = self._factory()
        for class_ in (mailbox.Message, mailbox.MaildirMessage,
                       mailbox.mboxMessage, mailbox.MHMessage,
                       mailbox.BabylMessage, mailbox.MMDFMessage):
            other_msg = class_()
            msg._explain_to(other_msg)
        other_msg = email.message.Message()
        self.assertRaises(TypeError, lambda: msg._explain_to(other_msg)) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:test_mailbox.py

示例4: test_plain_to_x

# 需要导入模块: import mailbox [as 别名]
# 或者: from mailbox import MMDFMessage [as 别名]
def test_plain_to_x(self):
        # Convert Message to all formats
        for class_ in (mailbox.Message, mailbox.MaildirMessage,
                       mailbox.mboxMessage, mailbox.MHMessage,
                       mailbox.BabylMessage, mailbox.MMDFMessage):
            msg_plain = mailbox.Message(_sample_message)
            msg = class_(msg_plain)
            self._check_sample(msg) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:test_mailbox.py

示例5: test_x_to_plain

# 需要导入模块: import mailbox [as 别名]
# 或者: from mailbox import MMDFMessage [as 别名]
def test_x_to_plain(self):
        # Convert all formats to Message
        for class_ in (mailbox.Message, mailbox.MaildirMessage,
                       mailbox.mboxMessage, mailbox.MHMessage,
                       mailbox.BabylMessage, mailbox.MMDFMessage):
            msg = class_(_sample_message)
            msg_plain = mailbox.Message(msg)
            self._check_sample(msg_plain) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:test_mailbox.py

示例6: test_x_to_invalid

# 需要导入模块: import mailbox [as 别名]
# 或者: from mailbox import MMDFMessage [as 别名]
def test_x_to_invalid(self):
        # Convert all formats to an invalid format
        for class_ in (mailbox.Message, mailbox.MaildirMessage,
                       mailbox.mboxMessage, mailbox.MHMessage,
                       mailbox.BabylMessage, mailbox.MMDFMessage):
            self.assertRaises(TypeError, lambda: class_(False)) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:8,代码来源:test_mailbox.py

示例7: test_mboxmmdf_to_maildir

# 需要导入模块: import mailbox [as 别名]
# 或者: from mailbox import MMDFMessage [as 别名]
def test_mboxmmdf_to_maildir(self):
        # Convert mboxMessage and MMDFMessage to MaildirMessage
        for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
            msg_mboxMMDF = class_(_sample_message)
            msg_mboxMMDF.set_from('foo@bar', time.gmtime(0.0))
            pairs = (('R', 'S'), ('O', ''), ('D', 'T'), ('F', 'F'), ('A', 'R'),
                     ('RODFA', 'FRST'))
            for setting, result in pairs:
                msg_mboxMMDF.set_flags(setting)
                msg = mailbox.MaildirMessage(msg_mboxMMDF)
                self.assertEqual(msg.get_flags(), result)
                self.assertEqual(msg.get_date(), 0.0)
            msg_mboxMMDF.set_flags('O')
            self.assertEqual(mailbox.MaildirMessage(msg_mboxMMDF).get_subdir(),
                             'cur') 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:17,代码来源:test_mailbox.py

示例8: test_mboxmmdf_to_mboxmmdf

# 需要导入模块: import mailbox [as 别名]
# 或者: from mailbox import MMDFMessage [as 别名]
def test_mboxmmdf_to_mboxmmdf(self):
        # Convert mboxMessage and MMDFMessage to mboxMessage and MMDFMessage
        for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
            msg_mboxMMDF = class_(_sample_message)
            msg_mboxMMDF.set_flags('RODFA')
            msg_mboxMMDF.set_from('foo@bar')
            for class2_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
                msg2 = class2_(msg_mboxMMDF)
                self.assertEqual(msg2.get_flags(), 'RODFA')
                self.assertEqual(msg2.get_from(), 'foo@bar') 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:test_mailbox.py

示例9: test_mboxmmdf_to_mh

# 需要导入模块: import mailbox [as 别名]
# 或者: from mailbox import MMDFMessage [as 别名]
def test_mboxmmdf_to_mh(self):
        # Convert mboxMessage and MMDFMessage to MHMessage
        for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
            msg_mboxMMDF = class_(_sample_message)
            pairs = (('R', []), ('O', ['unseen']), ('D', ['unseen']),
                     ('F', ['unseen', 'flagged']),
                     ('A', ['unseen', 'replied']),
                     ('RODFA', ['replied', 'flagged']))
            for setting, result in pairs:
                msg_mboxMMDF.set_flags(setting)
                self.assertEqual(mailbox.MHMessage(msg_mboxMMDF).get_sequences(),
                                 result) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:14,代码来源:test_mailbox.py

示例10: test_mboxmmdf_to_babyl

# 需要导入模块: import mailbox [as 别名]
# 或者: from mailbox import MMDFMessage [as 别名]
def test_mboxmmdf_to_babyl(self):
        # Convert mboxMessage and MMDFMessage to BabylMessage
        for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
            msg = class_(_sample_message)
            pairs = (('R', []), ('O', ['unseen']),
                     ('D', ['unseen', 'deleted']), ('F', ['unseen']),
                     ('A', ['unseen', 'answered']),
                     ('RODFA', ['deleted', 'answered']))
            for setting, result in pairs:
                msg.set_flags(setting)
                self.assertEqual(mailbox.BabylMessage(msg).get_labels(), result) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:test_mailbox.py

示例11: test_mh_to_mboxmmdf

# 需要导入模块: import mailbox [as 别名]
# 或者: from mailbox import MMDFMessage [as 别名]
def test_mh_to_mboxmmdf(self):
        # Convert MHMessage to mboxMessage and MMDFMessage
        pairs = (('unseen', 'O'), ('replied', 'ROA'), ('flagged', 'ROF'))
        for setting, result in pairs:
            msg = mailbox.MHMessage(_sample_message)
            msg.add_sequence(setting)
            for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
                self.assertEqual(class_(msg).get_flags(), result)
        msg = mailbox.MHMessage(_sample_message)
        msg.add_sequence('unseen')
        msg.add_sequence('replied')
        msg.add_sequence('flagged')
        for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
            self.assertEqual(class_(msg).get_flags(), 'OFA') 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:16,代码来源:test_mailbox.py


注:本文中的mailbox.MMDFMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。