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