本文整理汇总了Python中action.Action.agent方法的典型用法代码示例。如果您正苦于以下问题:Python Action.agent方法的具体用法?Python Action.agent怎么用?Python Action.agent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类action.Action
的用法示例。
在下文中一共展示了Action.agent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_starts_actions_and_adds_back_to_queue
# 需要导入模块: from action import Action [as 别名]
# 或者: from action.Action import agent [as 别名]
def test_starts_actions_and_adds_back_to_queue(self):
# given
start_time = 0
deadline = 10
action_to_start = Action(start_time, deadline+1)
action_to_start.agent = Mock(name="agent")
action_to_start.is_applicable = Mock(return_val=True)
action_to_start.apply = Mock(name="apply")
model = Mock(name="model")
execution_queue = PriorityQueue()
execution_queue.put(ActionState(action_to_start, start_time, ExecutionState.pre_start))
# when
actual, _stalled = simulator.execute_action_queue(model, execution_queue,
break_on_new_knowledge=False, deadline=deadline)
# then
assert_that(execution_queue.queue, has_length(1))
time, state, action = execution_queue.queue[0]
assert_that(time, equal_to(action_to_start.end_time))
assert_that(state, equal_to(ExecutionState.executing))
assert_that(action, equal_to(action_to_start))
assert_that(actual.executed, is_(empty()))
assert_that(is_not(action_to_start.apply.called))
assert_that(actual.simulation_time, equal_to(start_time))