本文整理汇总了Python中dispatcher.Dispatcher.getJobPriorityWeight方法的典型用法代码示例。如果您正苦于以下问题:Python Dispatcher.getJobPriorityWeight方法的具体用法?Python Dispatcher.getJobPriorityWeight怎么用?Python Dispatcher.getJobPriorityWeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dispatcher.Dispatcher
的用法示例。
在下文中一共展示了Dispatcher.getJobPriorityWeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestDispatcher
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import getJobPriorityWeight [as 别名]
class TestDispatcher(unittest.TestCase):
## Setup the dispatcher ##
def setUp(self):
self.dispatcher = Dispatcher(APPOINTMENT_FACTOR, PRIORITY_WEIGHT,PROXIMITY_WEIGHT,AUTOMATIC_UPGRADE,AUTOLOCATION_VALUE)
## This function should return default values from PRIORITY_WEIGHT ##
def test_getJobPriorityWeight(self):
for i in xrange(0,9):
self.assertEqual(self.dispatcher.getJobPriorityWeight(i), PRIORITY_WEIGHT[i][1])
## This function should return AppointmentFactor if passed True ##
def test_getAppointmentFactor(self):
self.assertEqual(self.dispatcher.getAppointmentFactor(True), APPOINTMENT_FACTOR)
self.assertEqual(self.dispatcher.getAppointmentFactor(False), 1)
## This function should add a job to the pending list ##
def test_addJob(self):
simState = Mock()
simState.env.process(return_value=None)
tmpJob = Job('1','2','3','4','5','6','7')
pendingLen = len(self.dispatcher.pending_jobs)
self.dispatcher.addJob(tmpJob,simState)
self.assertEqual(len(self.dispatcher.pending_jobs), pendingLen+1)