本文整理匯總了Python中aiorq.Queue.is_empty方法的典型用法代碼示例。如果您正苦於以下問題:Python Queue.is_empty方法的具體用法?Python Queue.is_empty怎麽用?Python Queue.is_empty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類aiorq.Queue
的用法示例。
在下文中一共展示了Queue.is_empty方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_queue_is_empty
# 需要導入模塊: from aiorq import Queue [as 別名]
# 或者: from aiorq.Queue import is_empty [as 別名]
def test_queue_is_empty(redis):
"""Detecting empty queues."""
q = Queue('example')
assert (yield from q.is_empty())
yield from redis.rpush('rq:queue:example', 'sentinel message')
assert not (yield from q.is_empty())
示例2: test_empty_queue
# 需要導入模塊: from aiorq import Queue [as 別名]
# 或者: from aiorq.Queue import is_empty [as 別名]
def test_empty_queue(redis):
"""Emptying queues."""
q = Queue('example', connection=redis)
yield from redis.rpush('rq:queue:example', 'foo')
yield from redis.rpush('rq:queue:example', 'bar')
assert not (yield from q.is_empty())
yield from q.empty()
assert (yield from q.is_empty())
assert (yield from redis.lpop('rq:queue:example')) is None
示例3: test_enqueue
# 需要導入模塊: from aiorq import Queue [as 別名]
# 或者: from aiorq.Queue import is_empty [as 別名]
def test_enqueue(redis):
"""Enqueueing job onto queues."""
q = Queue()
assert (yield from q.is_empty())
# say_hello spec holds which queue this is sent to
job = yield from q.enqueue(say_hello, 'Nick', foo='bar')
job_id = job.id
assert job.origin == q.name
# Inspect data inside Redis
q_key = 'rq:queue:default'
assert 1 == (yield from redis.llen(q_key))
assert job_id == (yield from redis.lrange(q_key, 0, -1))[0].decode('ascii')