How to use the punq.InvalidForwardReferenceException 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_string_annotations.py View on Github external
def test_forward_references_must_be_registered_before_their_clients():
    """
    If we haven't registered the 'Dependency' type yet, then we'll raise
    a specific error so people can at least work out what the hell is happening
    """
    container = punq.Container()

    with pytest.raises(punq.InvalidForwardReferenceException):
        container.register(Client)