Rename empty property -> is_empty() method.

main
Vincent Driessen 13 years ago
parent 9986fee00e
commit fcca48a9d7

@ -72,8 +72,7 @@ class Queue(object):
"""Returns the Redis key for this Queue.""" """Returns the Redis key for this Queue."""
return self._key return self._key
@property def is_empty(self):
def empty(self):
"""Returns whether the current queue is empty.""" """Returns whether the current queue is empty."""
return self.count == 0 return self.count == 0

@ -32,20 +32,20 @@ class TestQueue(RQTestCase):
def test_queue_empty(self): def test_queue_empty(self):
"""Detecting empty queues.""" """Detecting empty queues."""
q = Queue('my-queue') q = Queue('my-queue')
self.assertEquals(q.empty, True) self.assertEquals(q.is_empty(), True)
self.testconn.rpush('rq:queue:my-queue', 'some val') self.testconn.rpush('rq:queue:my-queue', 'some val')
self.assertEquals(q.empty, False) self.assertEquals(q.is_empty(), False)
def test_enqueue(self): def test_enqueue(self):
"""Putting work on queues.""" """Putting work on queues."""
q = Queue('my-queue') q = Queue('my-queue')
self.assertEquals(q.empty, True) self.assertEquals(q.is_empty(), True)
# testjob spec holds which queue this is sent to # testjob spec holds which queue this is sent to
q.enqueue(testjob, 'Nick', foo='bar') q.enqueue(testjob, 'Nick', foo='bar')
self.assertEquals(q.empty, False) self.assertEquals(q.is_empty(), False)
self.assertQueueContains(q, testjob) self.assertQueueContains(q, testjob)

Loading…
Cancel
Save