def test_register_plugin_handles_unicode(self): for plugin in self.invalid_plugins: with pytest.raises(TypeError): registry.register('invalid', plugin) for plugin in self.valid_plugins: name = u'{0}-{1}'.format(self.snowman, repr(plugin)) registry.register(name, plugin) assert name in registry.plugins
def test_register_plugin_handles_unicode(self): for plugin in self.invalid_plugins: with pytest.raises(TypeError): registry.register('invalid', plugin) for plugin in self.valid_plugins: name = u'{0}-{1}'.format(self.snowman, repr(plugin)) registry.register(name, plugin) assert name in registry.plugins
def test_get_plugin(self): registry.register('foo', self.valid_plugins[0]) registry.register(self.snowman, self.valid_plugins[0]) assert self.valid_plugins[0] == registry.get_plugin('foo') assert self.valid_plugins[0] == registry.get_plugin(self.snowman)
def test_all_plugins(self): registry.register('foo', self.valid_plugins[0]) assert set(['foo']) == registry.all_plugins
def test_register_valid_plugins(self): for plugin in self.valid_plugins: registry.register(repr(plugin), plugin) assert repr(plugin) in registry.plugins
def test_register_raises_typeerror(self): for plugin in self.invalid_plugins: with pytest.raises(TypeError): registry.register('invalid', plugin)
def test_get_plugin(self): registry.register('foo', self.valid_plugins[0]) registry.register(self.snowman, self.valid_plugins[0]) assert self.valid_plugins[0] == registry.get_plugin('foo') assert self.valid_plugins[0] == registry.get_plugin(self.snowman)
def test_all_plugins(self): registry.register('foo', self.valid_plugins[0]) assert set(['foo']) == registry.all_plugins
def test_register_valid_plugins(self): for plugin in self.valid_plugins: registry.register(repr(plugin), plugin) assert repr(plugin) in registry.plugins
def test_register_raises_typeerror(self): for plugin in self.invalid_plugins: with pytest.raises(TypeError): registry.register('invalid', plugin)