本文整理汇总了Python中plugin_manager.PluginManager.map_plugin_packets方法的典型用法代码示例。如果您正苦于以下问题:Python PluginManager.map_plugin_packets方法的具体用法?Python PluginManager.map_plugin_packets怎么用?Python PluginManager.map_plugin_packets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plugin_manager.PluginManager
的用法示例。
在下文中一共展示了PluginManager.map_plugin_packets方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_map_plugin_packets
# 需要导入模块: from plugin_manager import PluginManager [as 别名]
# 或者: from plugin_manager.PluginManager import map_plugin_packets [as 别名]
def test_map_plugin_packets(self, mock_config, mock_path, mock_sys):
mock_plugin = Mock()
mock_plugin.name = 'Test'
mock_plugin.overridden_packets = {
1: {
'on': 'add me on 1',
'after': 'add me after 1'
}
}
mock_plugin2 = Mock()
mock_plugin2.name = 'Test2'
mock_plugin2.overridden_packets = {
2: {
'on': 'add me on 2'
},
3: {
'after': 'add me after 2'
}
}
pm = PluginManager(Mock())
pm.map_plugin_packets(mock_plugin)
self.assertDictEqual(
pm.packets,
{
1: {
'on': {'Test': (mock_plugin, 'add me on 1')},
'after': {'Test': (mock_plugin, 'add me after 1')}
}
}
)
pm.map_plugin_packets(mock_plugin2)
self.assertDictEqual(
pm.packets,
{
1: {
'on': {'Test': (mock_plugin, 'add me on 1')},
'after': {'Test': (mock_plugin, 'add me after 1')}
},
2: {
'on': {'Test2': (mock_plugin2, 'add me on 2')}
},
3: {
'after': {'Test2': (mock_plugin2, 'add me after 2')}
}
}
)