python-dependency-injector/examples/advanced_usage/inject_simple.py
2015-09-28 21:56:36 +03:00

17 lines
423 B
Python

"""`@di.inject()` decorator simple example."""
import dependency_injector as di
dependency_injector_factory = di.Factory(object)
@di.inject(new_object=dependency_injector_factory)
@di.inject(some_setting=1334)
def example_callback(new_object, some_setting):
"""Example callback that does some asserts for input args."""
assert isinstance(new_object, object)
assert some_setting == 1334
example_callback()