How to use the punq.InvalidRegistrationException function in punq

To help you get started, we’ve selected a few punq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bobthemighty / punq / tests / test_instance_creation.py View on Github external
def test_registering_an_instance_as_factory_is_exception():
    """
    Concrete registrations need to be a constructable type
    or there's no key we can use for resolution.
    """
    container = Container()
    writer = MessageWriter()

    with pytest.raises(InvalidRegistrationException):
        container.register(MessageWriter, writer)
github bobthemighty / punq / tests / test_instance_creation.py View on Github external
def test_registering_an_instance_as_concrete_is_exception():
    """
    Concrete registrations need to be a constructable type
    or there's no key we can use for resolution.
    """
    container = Container()
    writer = MessageWriter()

    with pytest.raises(InvalidRegistrationException):
        container.register(writer)