當前位置: 首頁>>代碼示例>>Python>>正文


Python extensions.PluginAwareExtensionManager類代碼示例

本文整理匯總了Python中quantum.extensions.extensions.PluginAwareExtensionManager的典型用法代碼示例。如果您正苦於以下問題:Python PluginAwareExtensionManager類的具體用法?Python PluginAwareExtensionManager怎麽用?Python PluginAwareExtensionManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了PluginAwareExtensionManager類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_unsupported_extensions_are_not_loaded

    def test_unsupported_extensions_are_not_loaded(self):
        stub_plugin = StubPlugin(supported_extensions=["e1", "e3"])
        ext_mgr = PluginAwareExtensionManager('', stub_plugin)

        ext_mgr.add_extension(StubExtension("e1"))
        ext_mgr.add_extension(StubExtension("e2"))
        ext_mgr.add_extension(StubExtension("e3"))

        self.assertTrue("e1" in ext_mgr.extensions)
        self.assertFalse("e2" in ext_mgr.extensions)
        self.assertTrue("e3" in ext_mgr.extensions)
開發者ID:Milstein,項目名稱:quantum,代碼行數:11,代碼來源:test_extensions.py

示例2: test_extensions_expecting_quantum_plugin_interface_are_loaded

    def test_extensions_expecting_quantum_plugin_interface_are_loaded(self):
        class ExtensionForQuamtumPluginInterface(StubExtension):
            """
            This Extension does not implement get_plugin_interface method.
            This will work with any plugin implementing QuantumPluginBase
            """
            pass
        stub_plugin = StubPlugin(supported_extensions=["e1"])
        ext_mgr = PluginAwareExtensionManager('', stub_plugin)
        ext_mgr.add_extension(ExtensionForQuamtumPluginInterface("e1"))

        self.assertTrue("e1" in ext_mgr.extensions)
開發者ID:Milstein,項目名稱:quantum,代碼行數:12,代碼來源:test_extensions.py

示例3: test_extensions_are_not_loaded_for_plugins_unaware_of_extensions

    def test_extensions_are_not_loaded_for_plugins_unaware_of_extensions(self):
        class ExtensionUnawarePlugin(object):
            """
            This plugin does not implement supports_extension method.
            Extensions will not be loaded when this plugin is used.
            """
            pass

        ext_mgr = PluginAwareExtensionManager('', ExtensionUnawarePlugin())
        ext_mgr.add_extension(StubExtension("e1"))

        self.assertFalse("e1" in ext_mgr.extensions)
開發者ID:Milstein,項目名稱:quantum,代碼行數:12,代碼來源:test_extensions.py

示例4: test_extensions_not_loaded_for_plugin_without_expected_interface

    def test_extensions_not_loaded_for_plugin_without_expected_interface(self):
        class PluginWithoutExpectedInterface(object):
            """
            Plugin does not implement get_foo method as expected by extension
            """

            supported_extension_aliases = ["supported_extension"]

        ext_mgr = PluginAwareExtensionManager("", PluginWithoutExpectedInterface())
        ext_mgr.add_extension(ExtensionExpectingPluginInterface("supported_extension"))

        self.assertFalse("e1" in ext_mgr.extensions)
開發者ID:LuizOz,項目名稱:quantum,代碼行數:12,代碼來源:test_extensions.py

示例5: test_extensions_without_need_for__plugin_interface_are_loaded

    def test_extensions_without_need_for__plugin_interface_are_loaded(self):
        class ExtensionWithNoNeedForPluginInterface(StubExtension):
            """
            This Extension does not need any plugin interface.
            This will work with any plugin implementing QuantumPluginBase
            """
            def get_plugin_interface(self):
                return None

        stub_plugin = StubPlugin(supported_extensions=["e1"])
        ext_mgr = PluginAwareExtensionManager('', stub_plugin)
        ext_mgr.add_extension(ExtensionWithNoNeedForPluginInterface("e1"))

        self.assertTrue("e1" in ext_mgr.extensions)
開發者ID:Milstein,項目名稱:quantum,代碼行數:14,代碼來源:test_extensions.py

示例6: test_extensions_are_loaded_for_plugin_with_expected_interface

    def test_extensions_are_loaded_for_plugin_with_expected_interface(self):
        class PluginWithExpectedInterface(object):
            """
            This Plugin implements get_foo method as expected by extension
            """

            supported_extension_aliases = ["supported_extension"]

            def get_foo(self, bar=None):
                pass

        ext_mgr = PluginAwareExtensionManager("", PluginWithExpectedInterface())
        ext_mgr.add_extension(ExtensionExpectingPluginInterface("supported_extension"))

        self.assertTrue("supported_extension" in ext_mgr.extensions)
開發者ID:LuizOz,項目名稱:quantum,代碼行數:15,代碼來源:test_extensions.py


注:本文中的quantum.extensions.extensions.PluginAwareExtensionManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。