本文整理匯總了Python中ircmessage.IRCMessage.render方法的典型用法代碼示例。如果您正苦於以下問題:Python IRCMessage.render方法的具體用法?Python IRCMessage.render怎麽用?Python IRCMessage.render使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ircmessage.IRCMessage
的用法示例。
在下文中一共展示了IRCMessage.render方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: IRCMessageTest
# 需要導入模塊: from ircmessage import IRCMessage [as 別名]
# 或者: from ircmessage.IRCMessage import render [as 別名]
class IRCMessageTest(unittest.TestCase):
def setUp(self):
self.channel = "#test-channel"
self.user = "pedro"
self.m = IRCMessage(self.channel, "---", self.user, True)
def testIsInitialized(self):
self.assertTrue(self.m.is_initialized())
q = IRCMessage()
self.assertFalse(q.is_initialized())
## Message with no channel should be false.
q.channel = "#"
q.msg = "notempty"
self.assertFalse(q.is_initialized())
## Adding directed testing.
q.channel = self.channel
q.directed = True
self.assertFalse(q.is_initialized())
q.user = self.user
self.assertTrue(q.is_initialized())
def testEquality(self):
n = IRCMessage(self.channel, "---", self.user, True)
self.assertEquals(self.m, n)
n.msg = "!-"
self.assertNotEquals(self.m, n)
n.msg = self.m.msg
n.channel = "#"
self.assertNotEquals(self.m, n)
## A fake directed should not be equal.
n = IRCMessage(self.channel, "---", self.user, False)
self.m.directed = True
self.assertNotEquals(self.m, n)
n.msg = "{0}: {1}".format(n.user, n.msg)
self.assertNotEquals(self.m, n)
def testRender(self):
expected = "{0}: {1}".format(self.m.user, self.m.msg)
self.assertEquals(self.m.render(), expected)
expected = self.m.msg
self.m.directed = False
self.assertEquals(self.m.render(), expected)