Esempio n. 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}', )
Esempio n. 2
0
def controller(controller_class: Type) -> Type:
    Component.register(controller_class)
    return controller_class