本文整理汇总了Python中pypeman.channels.BaseChannel.append方法的典型用法代码示例。如果您正苦于以下问题:Python BaseChannel.append方法的具体用法?Python BaseChannel.append怎么用?Python BaseChannel.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypeman.channels.BaseChannel
的用法示例。
在下文中一共展示了BaseChannel.append方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_sub_channel
# 需要导入模块: from pypeman.channels import BaseChannel [as 别名]
# 或者: from pypeman.channels.BaseChannel import append [as 别名]
def test_sub_channel(self):
""" Whether Sub Channel is working """
chan = BaseChannel(name="test_channel3", loop=self.loop)
n1 = TestNode(name="main")
n2 = TestNode(name="sub")
n3 = TestNode(name="sub1")
n4 = TestNode(name="sub2")
msg = generate_msg()
same_chan = chan.append(n1)
self.assertEqual(chan, same_chan, "Append don't return channel.")
sub = chan.fork(name="subchannel")
sub.append(n2, n3, n4)
# Launch channel processing
self.start_channels()
self.loop.run_until_complete(chan.handle(msg))
self.assertTrue(n2.processed, "Sub Channel not working")
self.assertTrue(n3.processed, "Sub Channel not working")
self.assertTrue(n4.processed, "Sub Channel not working")
self.assertEqual(sub.name, "test_channel3.subchannel", "Subchannel name is incorrect")