本文整理汇总了Python中slimta.util.deque.BlockingDeque.extend方法的典型用法代码示例。如果您正苦于以下问题:Python BlockingDeque.extend方法的具体用法?Python BlockingDeque.extend怎么用?Python BlockingDeque.extend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类slimta.util.deque.BlockingDeque
的用法示例。
在下文中一共展示了BlockingDeque.extend方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestBlockingDeque
# 需要导入模块: from slimta.util.deque import BlockingDeque [as 别名]
# 或者: from slimta.util.deque.BlockingDeque import extend [as 别名]
class TestBlockingDeque(MoxTestBase, unittest.TestCase):
def setUp(self):
super(TestBlockingDeque, self).setUp()
self.deque = BlockingDeque()
self.deque.sema = self.mox.CreateMockAnything()
def test_append(self):
self.deque.sema.release()
self.mox.ReplayAll()
self.deque.append(True)
def test_appendleft(self):
self.deque.sema.release()
self.mox.ReplayAll()
self.deque.appendleft(True)
def test_clear(self):
for i in range(3):
self.deque.sema.release()
for i in range(3):
self.deque.sema.locked().AndReturn(False)
self.deque.sema.acquire(blocking=False)
self.deque.sema.locked().AndReturn(True)
self.mox.ReplayAll()
self.deque.append(True)
self.deque.append(True)
self.deque.append(True)
self.deque.clear()
def test_extend(self):
self.deque.sema.release()
self.deque.sema.release()
self.deque.sema.release()
self.mox.ReplayAll()
self.deque.extend([1, 2, 3])
def test_extendleft(self):
self.deque.sema.release()
self.deque.sema.release()
self.deque.sema.release()
self.mox.ReplayAll()
self.deque.extendleft([1, 2, 3])
def test_pop(self):
self.deque.sema.release()
self.deque.sema.release()
self.deque.sema.acquire()
self.mox.ReplayAll()
self.deque.append(4)
self.deque.append(5)
self.assertEqual(5, self.deque.pop())
def test_popleft(self):
self.deque.sema.release()
self.deque.sema.release()
self.deque.sema.acquire()
self.mox.ReplayAll()
self.deque.append(4)
self.deque.append(5)
self.assertEqual(4, self.deque.popleft())
def test_remove(self):
self.deque.sema.release()
self.deque.sema.release()
self.deque.sema.acquire()
self.mox.ReplayAll()
self.deque.append(4)
self.deque.append(5)
self.deque.remove(4)
def test_remove_notfound(self):
self.deque.sema.release()
self.deque.sema.release()
self.mox.ReplayAll()
self.deque.append(4)
self.deque.append(5)
with self.assertRaises(ValueError):
self.deque.remove(6)