Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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)