本文整理汇总了Python中ircmessage.IRCMessage.is_initialized方法的典型用法代码示例。如果您正苦于以下问题:Python IRCMessage.is_initialized方法的具体用法?Python IRCMessage.is_initialized怎么用?Python IRCMessage.is_initialized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ircmessage.IRCMessage
的用法示例。
在下文中一共展示了IRCMessage.is_initialized方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testIsInitialized
# 需要导入模块: from ircmessage import IRCMessage [as 别名]
# 或者: from ircmessage.IRCMessage import is_initialized [as 别名]
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())
示例2: IRCMessageTest
# 需要导入模块: from ircmessage import IRCMessage [as 别名]
# 或者: from ircmessage.IRCMessage import is_initialized [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)