# Path: paco/run.py
# def run(coro, loop=None):
#     """
#     Convenient shortcut alias to ``loop.run_until_complete``.
# 
#     Arguments:
#         coro (coroutine): coroutine object to schedule.
#         loop (asyncio.BaseEventLoop): optional event loop to use.
#             Defaults to: ``asyncio.get_event_loop()``.
# 
#     Returns:
#         mixed: returned value by coroutine.
# 
#     Usage::
# 
#         async def mul_2(num):
#             return num * 2
# 
#         paco.run(mul_2(4))
#         # => 8
# 
#     """
#     loop = loop or asyncio.get_event_loop()
#     return loop.run_until_complete(coro)


import asyncio
from paco import run
# -*- coding: utf-8 -*-


@asyncio.coroutine
def coro(num):
    return num * 2


def test_run():
    assert run(coro(2)) == 4


def test_run_loop():
    loop = asyncio.get_event_loop()

# Path: paco/run.py
# def run(coro, loop=None):
#     """
#     Convenient shortcut alias to ``loop.run_until_complete``.
# 
#     Arguments:
#         coro (coroutine): coroutine object to schedule.
#         loop (asyncio.BaseEventLoop): optional event loop to use.
#             Defaults to: ``asyncio.get_event_loop()``.
# 
#     Returns:
#         mixed: returned value by coroutine.
# 
#     Usage::
# 
#         async def mul_2(num):
#             return num * 2
# 
#         paco.run(mul_2(4))
#         # => 8
# 
#     """
#     loop = loop or asyncio.get_event_loop()
#     return loop.run_until_complete(coro)


# Path: tests/run_test.py
import asyncio
from paco import run

# -*- coding: utf-8 -*-


@asyncio.coroutine
def coro(num):
    return num * 2


def test_run():
    assert run(coro(2)) == 4


def test_run_loop():
    loop = asyncio.get_event_loop()

    assert run(coro(2), loop=loop) == 4