# Path: jega/loop.py
# _MAX_WORKERS = 5
# def _raise_stop_error(*args):
#     def __init__(self):
#     def reset(self):
#     def add_signal_handler(self, sig, callback, *args):
#     def _handle_signal(self, sig, arg):
#     def remove_signal_handler(self, sig):
#     def _check_signal(self, sig):
#     def _socketpair(self):
#     def _close_self_pipe(self):
#     def _make_self_pipe(self):
#     def _read_from_self(self):
#     def _write_to_self(self):
#     def destroy(self):
#     def wrap_future(self, future):
#     def run(self):
#     def run_once(self):
#     def run_forever(self):
#     def run_until_complete(self, future, timeout=None):
#     def stop(self):
#     def call_soon_threadsafe(self, callback, *args):
#     def run_in_executor(self, executor, callback, *args):
#     def set_default_executor(self, executor):
#     def getaddrinfo(self, host, port, family=0, type=0, proto=0, flags=0):
#     def getnameinfo(self, sockaddr, flags=0):
#     def _add_callback_signalsafe(self, handle):
#     def set_socket_acceptor(self, sock, acceptor):
# def internal_acceptor(accept, acceptor):
# def get_event_loop():
# def spawn(cb, *args):
# class JegaEventLoop(jega.AbstractEventLoop):


from jega.event import *
from pytest import *
from jega import loop
from util import *
import jega


def test_event_simple():
    print_name()
    ev = Event()

    def waiter():
        r = ev.wait()
        return r

    f1 = jega.spawn(waiter)
    f2 = jega.spawn(ev.set)

    r = f1.result()
    assert(True == r)
    r = f2.result()
    assert(None == r)


def test_event_timeout():
    print_name()

# Path: jega/loop.py
# _MAX_WORKERS = 5
# def _raise_stop_error(*args):
#     def __init__(self):
#     def reset(self):
#     def add_signal_handler(self, sig, callback, *args):
#     def _handle_signal(self, sig, arg):
#     def remove_signal_handler(self, sig):
#     def _check_signal(self, sig):
#     def _socketpair(self):
#     def _close_self_pipe(self):
#     def _make_self_pipe(self):
#     def _read_from_self(self):
#     def _write_to_self(self):
#     def destroy(self):
#     def wrap_future(self, future):
#     def run(self):
#     def run_once(self):
#     def run_forever(self):
#     def run_until_complete(self, future, timeout=None):
#     def stop(self):
#     def call_soon_threadsafe(self, callback, *args):
#     def run_in_executor(self, executor, callback, *args):
#     def set_default_executor(self, executor):
#     def getaddrinfo(self, host, port, family=0, type=0, proto=0, flags=0):
#     def getnameinfo(self, sockaddr, flags=0):
#     def _add_callback_signalsafe(self, handle):
#     def set_socket_acceptor(self, sock, acceptor):
# def internal_acceptor(accept, acceptor):
# def get_event_loop():
# def spawn(cb, *args):
# class JegaEventLoop(jega.AbstractEventLoop):


# Path: tests/test_event.py
from jega.event import *
from pytest import *
from jega import loop
from util import *
import jega



def test_event_simple():
    print_name()
    ev = Event()

    def waiter():
        r = ev.wait()
        return r

    f1 = jega.spawn(waiter)
    f2 = jega.spawn(ev.set)

    r = f1.result()
    assert(True == r)
    r = f2.result()
    assert(None == r)


def test_event_timeout():
    print_name()

    event_loop = loop.get_event_loop()