mirror of https://github.com/rq/rq.git
Rename empty property -> is_empty() method.
This commit is contained in:
parent
9986fee00e
commit
fcca48a9d7
|
@ -72,8 +72,7 @@ class Queue(object):
|
|||
"""Returns the Redis key for this Queue."""
|
||||
return self._key
|
||||
|
||||
@property
|
||||
def empty(self):
|
||||
def is_empty(self):
|
||||
"""Returns whether the current queue is empty."""
|
||||
return self.count == 0
|
||||
|
||||
|
|
|
@ -32,20 +32,20 @@ class TestQueue(RQTestCase):
|
|||
def test_queue_empty(self):
|
||||
"""Detecting empty queues."""
|
||||
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.assertEquals(q.empty, False)
|
||||
self.assertEquals(q.is_empty(), False)
|
||||
|
||||
|
||||
def test_enqueue(self):
|
||||
"""Putting work on queues."""
|
||||
q = Queue('my-queue')
|
||||
self.assertEquals(q.empty, True)
|
||||
self.assertEquals(q.is_empty(), True)
|
||||
|
||||
# testjob spec holds which queue this is sent to
|
||||
q.enqueue(testjob, 'Nick', foo='bar')
|
||||
self.assertEquals(q.empty, False)
|
||||
self.assertEquals(q.is_empty(), False)
|
||||
self.assertQueueContains(q, testjob)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue