当前位置: 首页>>代码示例>>Python>>正文


Python ResizableDispatchQueue.width方法代码示例

本文整理汇总了Python中txrdq.rdq.ResizableDispatchQueue.width方法的典型用法代码示例。如果您正苦于以下问题:Python ResizableDispatchQueue.width方法的具体用法?Python ResizableDispatchQueue.width怎么用?Python ResizableDispatchQueue.width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在txrdq.rdq.ResizableDispatchQueue的用法示例。


在下文中一共展示了ResizableDispatchQueue.width方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testIncrementToVeryHighValueThenSetToLowValueThenIncrement

# 需要导入模块: from txrdq.rdq import ResizableDispatchQueue [as 别名]
# 或者: from txrdq.rdq.ResizableDispatchQueue import width [as 别名]
 def testIncrementToVeryHighValueThenSetToLowValueThenIncrement(self):
     """
     Create a queue of width 10 and then set its width to 1000 then set
     it to 100, then to 500.  The number of pending stops will be 500.
     """
     dq = ResizableDispatchQueue(None, 10)
     dq.width = 1000
     dq.width = 100
     dq.width = 500
     self.assertEqual(dq.pendingStops, 500)
     return dq.stop()
开发者ID:jcollie,项目名称:txrdq,代码行数:13,代码来源:test_rdq.py

示例2: testNarrowWiden

# 需要导入模块: from txrdq.rdq import ResizableDispatchQueue [as 别名]
# 或者: from txrdq.rdq.ResizableDispatchQueue import width [as 别名]
 def testNarrowWiden(self):
     """
     Create a queue of width 10. Narrowing to 7 means there will be 3
     pending stops, then widening to 8 will decrease the number of
     pending stops to 2.
     """
     dq = ResizableDispatchQueue(None, 10)
     dq.width = 7
     self.assertEqual(dq.pendingStops, 3)
     dq.width = 8
     self.assertEqual(dq.pendingStops, 2)
     return dq.stop()
开发者ID:jcollie,项目名称:txrdq,代码行数:14,代码来源:test_rdq.py

示例3: testJustOneWithZeroInitialWidth

# 需要导入模块: from txrdq.rdq import ResizableDispatchQueue [as 别名]
# 或者: from txrdq.rdq.ResizableDispatchQueue import width [as 别名]
 def testJustOneWithZeroInitialWidth(self):
     # Same as testJustOne (above), except we initialize with zero width
     # and start the dispatcher by explicitly setting its width.
     dq = ResizableDispatchQueue(self.slow)
     map(dq.put, range(3))
     self.assertEqual(0, dq.width)
     dq.width = 1
     return self._stopAndTest(0.0001, dq, [1, 2])
开发者ID:jcollie,项目名称:txrdq,代码行数:10,代码来源:test_rdq.py

示例4: testSetImmediatelyToZero

# 需要导入模块: from txrdq.rdq import ResizableDispatchQueue [as 别名]
# 或者: from txrdq.rdq.ResizableDispatchQueue import width [as 别名]
 def testSetImmediatelyToZero(self):
     """
     Create a queue of width 10 and then set its width to 0.
     The number of pending stops will be 10.
     """
     dq = ResizableDispatchQueue(None, 10)
     dq.width = 0
     self.assertEqual(dq.pendingStops, 10)
     return dq.stop()
开发者ID:jcollie,项目名称:txrdq,代码行数:11,代码来源:test_rdq.py

示例5: testNarrow

# 需要导入模块: from txrdq.rdq import ResizableDispatchQueue [as 别名]
# 或者: from txrdq.rdq.ResizableDispatchQueue import width [as 别名]
 def testNarrow(self):
     """
     Create a queue of width 5 and narrow it to width 3. There should
     then be 2 pending stops.
     """
     dq = ResizableDispatchQueue(None, 5)
     dq.width = 3
     self.assertEqual(2, dq.pendingStops)
     return dq.stop()
开发者ID:jcollie,项目名称:txrdq,代码行数:11,代码来源:test_rdq.py

示例6: testSetWidthToZeroAfterInitiallyNonZeroThenStop

# 需要导入模块: from txrdq.rdq import ResizableDispatchQueue [as 别名]
# 或者: from txrdq.rdq.ResizableDispatchQueue import width [as 别名]
 def testSetWidthToZeroAfterInitiallyNonZeroThenStop(self):
     """
     Make sure that a queue whose width is initially non-zero and which
     is then set to zero width returns all the added jobs when stopped.
     """
     dq = ResizableDispatchQueue(None, 3)
     dq.width = 0
     dq.put('aaa', 5)
     dq.put('bbb', 10)
     remaining = yield dq.stop()
     self.assertEqual(['aaa', 'bbb'], [job.jobarg for job in remaining])
开发者ID:jcollie,项目名称:txrdq,代码行数:13,代码来源:test_rdq.py

示例7: testSetWidthToZeroAfterInitiallyNonZero

# 需要导入模块: from txrdq.rdq import ResizableDispatchQueue [as 别名]
# 或者: from txrdq.rdq.ResizableDispatchQueue import width [as 别名]
 def testSetWidthToZeroAfterInitiallyNonZero(self):
     """
     Make sure that a queue whose width is initially non-zero and which
     is then set to zero width does not then begin to process any added
     jobs.
     """
     dq = ResizableDispatchQueue(None, 3)
     dq.width = 0
     dq.put('aaa')
     dq.put('bbb')
     self.assertEqual((0, 2), dq.size())
     return dq.stop()
开发者ID:jcollie,项目名称:txrdq,代码行数:14,代码来源:test_rdq.py


注:本文中的txrdq.rdq.ResizableDispatchQueue.width方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。