You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
645 B

import gevent
from unittest import TestCase
from disco.voice.queue import PlayableQueue
class TestPlayableQueue(TestCase):
def test_append(self):
q = PlayableQueue()
q.append(1)
q.append(2)
q.append(3)
self.assertEqual(q._data, [1, 2, 3])
self.assertEqual(q.get(), 1)
self.assertEqual(q.get(), 2)
self.assertEqual(q.get(), 3)
def test_blocking_get(self):
q = PlayableQueue()
result = gevent.event.AsyncResult()
def get():
result.set(q.get())
gevent.spawn(get)
q.append(5)
self.assertEqual(result.get(), 5)