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_magic_executor(args, kwargs, expected_return):
loop = asyncio.get_event_loop()
def non_executor(a, b=None, *, c) -> tuple:
return a, b, c
exact_executor = executor_function(non_executor)
@executor_function
def redefined_executor(a, b=None, *, c) -> tuple:
return a, b, c
assert inspect.signature(non_executor) == inspect.signature(exact_executor)
assert inspect.signature(non_executor) == inspect.signature(redefined_executor)
assert non_executor(*args, **kwargs) == expected_return
assert loop.run_until_complete(exact_executor(*args, **kwargs)) == expected_return
assert loop.run_until_complete(redefined_executor(*args, **kwargs)) == expected_return
@executor_function
def redefined_executor(a, b=None, *, c) -> tuple:
return a, b, c