def wrapper(*args, **kwargs): with loop_context() as loop: injector = Injector(loop=loop, fake_future=lambda: fake_future) asyncio.get_child_watcher().attach_loop(loop) asyncio.set_event_loop(loop) loop.run_until_complete(injector.call(f, *args, **kwargs))
def test_injection_direct_call(self): injector = Injector(a='A', b='A') value = injector.call(lambda a, b, c: a + b + c, b='B', c='C') self.assertEqual(value, "ABC")