Did I find the right examples for you? yes no

All Samples(7)  |  Call(5)  |  Derive(0)  |  Import(2)

        def make_injector(app, global_config, **local_config):
    local_config = convert_config(local_config)
    # Look up injector factory by name.
    injector_name = local_config.pop('injector', 'topbottom')
    injector_factory = fanstatic.registry.InjectorRegistry.instance().get(injector_name)
    if injector_factory is None:
        raise ConfigurationError(
            'No injector found for name %s' % injector_name)
    injector = injector_factory(local_config)
    return Injector(app, injector=injector, **local_config)
        


src/f/a/fanstatic-1.0a5/tests/test_injectorplugin.py   fanstatic(Download)
from fanstatic.injector import InjectorPlugin
from fanstatic.registry import InjectorRegistry
from fanstatic import make_injector
from fanstatic import compat
from fanstatic import ConfigurationError
def test_wsgi_middleware_lookup_injector():
    injector_middleware = make_injector(None, {})
    # Default is the topbottom injector
    assert isinstance(injector_middleware.injector, TopBottomInjector)
 
    with pytest.raises(ConfigurationError):
        make_injector(None, {}, injector='foo')
def test_wsgi_middleware_lookup_injector_register(injectors):
    with pytest.raises(ConfigurationError):
        make_injector(None, {}, injector='top')
 
    injectors.add_injector(TopInjector)
 
    # After registering, no longer raise a Configuration Error.
    make_injector(None, {}, injector='top')

src/f/a/fanstatic-1.0a5/tests/test_config.py   fanstatic(Download)
from fanstatic.config import convert_config
from fanstatic import make_injector, make_publisher, make_fanstatic
 
 
def test_convert_config():
        'rollup': 0,
    }
    injector = make_injector(None, {}, **d)
    assert injector.app is None
    assert injector.config == {