napari_plugin_engine/_testsupport.py
def caller_from_implementation(
    test_plugin_manager, add_specification, add_implementation
):
    """Return hook caller with implementation as its own spec definition.

    Adds a specification and implementation to the test_plugin_manager based on
    a single function definition (e.g. assumes that the implementation has the
    correct signature).  Returns the hook caller instance prepopulated with the
    hook implementation.
    """

    def wrap(func, spec_kwargs={}, impl_kwargs={}):
        add_specification(func, **spec_kwargs)
        add_implementation(func, **impl_kwargs)
        name = spec_kwargs.get('specname') or func.__name__
        return getattr(test_plugin_manager.hook, name)

    return wrap
Return hook caller with implementation as its own spec definition.

    Adds a specification and implementation to the test_plugin_manager based on
    a single function definition (e.g. assumes that the implementation has the
    correct signature).  Returns the hook caller instance prepopulated with the
    hook implementation.
    
Return hook caller with implementation as its own spec definition.
Adds a specification and implementation to the test_plugin_manager based on
a single function definition .  Returns the hook caller instance prepopulated with the
hook implementation.
Return hook caller with implementation as its own spec definition . Adds a specification and implementation to the test_plugin_manager based on a single function definition . Returns the hook caller instance prepopulated with the hook implementation .
def caller_from_implementation(
    test_plugin_manager, add_specification, add_implementation
):
    def wrap(func, spec_kwargs={}, impl_kwargs={}):
        add_specification(func, **spec_kwargs)
        add_implementation(func, **impl_kwargs)
        name = spec_kwargs.get('specname') or func.__name__
        return getattr(test_plugin_manager.hook, name)
    return wrap
def caller_from_implementation ( test_plugin_manager , add_specification , add_implementation ) : def wrap ( func , spec_kwargs = { } , impl_kwargs = { } ) : add_specification ( func , ** spec_kwargs ) add_implementation ( func , ** impl_kwargs ) name = spec_kwargs . get ( 'specname' ) or func . __name__ return getattr ( test_plugin_manager . hook , name ) return wrap
Return hook caller with implementation as its own spec definition.
Return hook caller with implementation as its own spec definition .
"""Return hook caller with implementation as its own spec definition.

    Adds a specification and implementation to the test_plugin_manager based on
    a single function definition (e.g. assumes that the implementation has the
    correct signature).  Returns the hook caller instance prepopulated with the
    hook implementation.
    """
test_plugin_manager
add_specification
add_implementation