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


Python Message.isSender方法代码示例

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


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

示例1: GoodMessage

# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import isSender [as 别名]
class GoodMessage(unittest.TestCase):
    
    def setUp(self):
        """ initial setup for testing """
        self.msg = Message('Sender', 'Recepient', 'Content')

    def testGoodSender(self):
        """ tests for good sender. It should pass. """
        self.assertTrue(self.msg.isSender())

    def testGoodRecipient(self):
        """ tests for good recipient. It should pass. """
        self.assertTrue(self.msg.isRecipient())
    
    def testGoodContent(self):
        """ tests for good content. It should pass. """
        self.assertTrue(self.msg.isContent())

    def testRealMsg(self):
        """ tests for an existed, 'populated' message. It should pass. """
        self.assertFalse(self.msg.isEmpty())

    @unittest.skip("no use for this test")
    def testLargeMsg(self):
        """ tests for a large message. It should pass. """
        self.assertRaises(Message.OutOfRangeError, self.msg.size, 999999999999)

    def testComputeMsgSize(self):
        """ tests for size computation. It should pass. """
        self.assertTrue(self.msg.computeMsgSize())
开发者ID:cbabalis,项目名称:Elita,代码行数:32,代码来源:testMessage.py

示例2: BadMessage

# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import isSender [as 别名]
class BadMessage(unittest.TestCase):
    
    def setUp(self):
        """ initial set up for testing """
        self.msg = Message('', '', '')  # blank message created

    def testBadSender(self):
        """ tests for no sender. It should fail. """
        self.assertFalse(self.msg.isSender())

    def testBadRecipient(self):
        """ tests for bad recipient. It should fail. """
        self.assertFalse(self.msg.isRecipient())

    def testBadContent(self):
        """ tests for bad content. It should fail. """
        self.assertFalse(self.msg.isContent())

    def testEmptyMessage(self):
        """ tests for empty message. It should fail. """
        self.assertEqual(self.msg.isEmpty(), 0)
开发者ID:cbabalis,项目名称:Elita,代码行数:23,代码来源:testMessage.py


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