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


Python Dispatcher.getAppointmentFactor方法代码示例

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


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

示例1: TestDispatcher

# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import getAppointmentFactor [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)
开发者ID:vkondrav,项目名称:Porter-Simulation,代码行数:26,代码来源:dispatcherUnit.py


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