Exemplo n.º 1
0
    def test_unregister(self):

        registry = PluginRegistry('dummy')
        klass = lambda: 1  # NOQA
        registry.register('dust', klass)
        self.assertEqual(list(registry.keys()), ['dust'])
        self.assertEqual(list(registry.values()), [klass])
        registry.unregister('dust')
Exemplo n.º 2
0
    def test_condition(self):

        registry = PluginRegistry('dummy')

        @registry.register('mud', condition=False)
        class _plugin_impl:
            pass

        self.assertEqual(list(registry.keys()), [])

        def _plugin_impl_func():
            pass

        registry.register('concrete', _plugin_impl_func, condition=False)
        self.assertEqual(list(registry.keys()), [])
Exemplo n.º 3
0
    def test_condition(self):

        registry = PluginRegistry('dummy')

        @registry.register('mud', condition=False)
        class _plugin_impl:
            pass

        self.assertEqual(list(registry.keys()), [])

        def _plugin_impl_func():
            pass

        registry.register('concrete', _plugin_impl_func, condition=False)
        self.assertEqual(list(registry.keys()), [])
Exemplo n.º 4
0
    def test_unregister(self):

        registry = PluginRegistry('dummy')
        registry.register('dust', klass=lambda: 1)
        self.assertEqual(list(registry.keys()), ['dust'])
        registry.unregister('dust')