Пример #1
0
def test_implicit_component_lookup():
    class ITarget(Interface):
        pass

    reg = Registry()

    reg.register(ITarget, (), 'test component')

    implicit.initialize(reg)
    assert ITarget.component() == 'test component'
Пример #2
0
def test_implicit_component_lookup():
    @generic
    def func():
        pass

    reg = Registry()

    reg.register(func, (), 'test component')

    implicit.initialize(reg)
    assert func.component() == 'test component'
Пример #3
0
def test_implicit_component_lookup():
    @generic
    def func():
        pass

    reg = Registry()

    reg.register(func, (), 'test component')

    implicit.initialize(reg)
    assert func.component() == 'test component'
Пример #4
0
def test_implicit_component_lookup():
    @dispatch()
    def func():
        pass

    def foo():
        pass

    reg = Registry()

    reg.register_dispatch(func)
    reg.register_function(func, foo)

    implicit.initialize(reg.lookup())
    assert func.component() is foo
Пример #5
0
def setup_function(f):
    implicit.initialize(Registry().lookup())
Пример #6
0
def setup_function(f):
    implicit.initialize(Registry())