Example #1
0
def test_register_with_instance():
    instance = object()

    with pytest.raises(ValueError) as exception:
        Component.register(instance)

    assert str(exception.value) == f'Need class. Got: {instance}'
    assert exception.value.args == (f'Need class. Got: {instance}', )
Example #2
0
def controller(controller_class: Type) -> Type:
    Component.register(controller_class)
    return controller_class