Пример #1
0
    def test_waiting(self):
        def do_wait(q, evt):
            result = q.join()
            evt.send(result)

        q = Queue()
        e1 = Event()
        spawn(do_wait, q, e1)
        sleep(0)
        self.assertEquals(1, q.join())
        q.put('hi')
        sleep(0)
        self.assertEquals(0, q.join())
        self.assertEquals('hi', e1.wait())
        self.assertEquals(0, q.join())
Пример #2
0
    def test_waiting (self):
        def do_wait (q, evt):
            result = q.join()
            evt.send(result)

        q = Queue()
        e1 = Event()
        spawn(do_wait, q, e1)
        sleep(0)
        self.assertEquals(1, q.join())
        q.put('hi')
        sleep(0)
        self.assertEquals(0, q.join())
        self.assertEquals('hi', e1.wait())
        self.assertEquals(0, q.join())
Пример #3
0
    def test_senders_that_die(self):
        q = Queue()

        def do_send(q):
            q.put('sent')

        spawn(do_send, q)
        self.assertEquals(q.join(), 'sent')
Пример #4
0
    def test_senders_that_die (self):
        q = Queue()

        def do_send (q):
            q.put('sent')

        spawn(do_send, q)
        self.assertEquals(q.join(), 'sent')