Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(22)  |  Call(22)  |  Derive(0)  |  Import(0)

src/g/r/gruvi-0.9.2/tests/test_sync.py   gruvi(Download)
    def test_basic(self):
        # What is put in the queue, should come out.
        queue = gruvi.Queue()
        queue.put(10)
        self.assertEqual(queue.get(), 10)
 
    def test_types(self):
        # Queue should support putting in arbitrary objects.
        queue = gruvi.Queue()
        queue.put('foo')
        queue.put('foo')
        self.assertEqual(queue.get(), 'foo')
        queue.put(['foo'])
        self.assertEqual(queue.get(), ['foo'])
 
    def test_fifo(self):
        # The default behavior of a queue should be FIFO
        queue = gruvi.Queue()
        for i in range(10):
            queue.put(10+i)
        queue = gruvi.Queue(priofunc=lambda el: len(el))
        for i in range(10):
            queue.put(i * 'x')
        for i in range(10):
            self.assertEqual(queue.get(), (10-i-1) * 'x')

src/g/r/gruvi-HEAD/tests/test_sync.py   gruvi(Download)
    def test_basic(self):
        # What is put in the queue, should come out.
        queue = gruvi.Queue()
        queue.put(10)
        self.assertEqual(queue.get(), 10)
 
    def test_types(self):
        # Queue should support putting in arbitrary objects.
        queue = gruvi.Queue()
        queue.put('foo')
        queue.put('foo')
        self.assertEqual(queue.get(), 'foo')
        queue.put(['foo'])
        self.assertEqual(queue.get(), ['foo'])
 
    def test_fifo(self):
        # The default behavior of a queue should be FIFO
        queue = gruvi.Queue()
        for i in range(10):
            queue.put(10+i)
        queue = gruvi.Queue(priofunc=lambda el: len(el))
        for i in range(10):
            queue.put(i * 'x')
        for i in range(10):
            self.assertEqual(queue.get(), (10-i-1) * 'x')