Exemplo n.º 1
0
def test_threaded_future():
    f = Future()
    def setter():
        sleep(0.01)
        f.set(13)

    th = TestThread(target=setter)
    th.setDaemon(True)
    th.start()

    eq_(f.wait(1), 13)
    eq_(f.value, 13)
    th.join()
Exemplo n.º 2
0
def test_simple_future():
    f = Future()
    f.set(3)
    eq_(f.wait(4), 3)
    eq_(f.wait(4), 3)