def testPipeLost(self): """Make sure losing the pipe goes back to search""" # Setup data self.ai.data['pipeData']['absoluteDirection'] = {} self.ai.data['pipeData']['currentID'] = 0 # Set the lastPipeEvent for FindAttempt self.ai.data['lastPipeEvent'] = vision.PipeEvent() self.injectEvent(vision.EventType.PIPE_LOST) # Make sure we changed state properly self.assertCurrentState(pipe.FindAttempt) # Make sure we dropped the currentID self.assertFalse(self.ai.data['pipeData'].has_key('currentID')) self.assertFalse(self.ai.data['pipeData'].has_key('absoluteDirection'))
def testPipeLost(self): """Make sure we search when we lose the pipe""" # Set the last pipe event for FindAttempt self.ai.data['lastPipeEvent'] = vision.PipeEvent() self.injectEvent(vision.EventType.PIPE_LOST) self.assertCurrentState(pipe.FindAttempt)
def setUp(self): PipeTest.setUp(self) # Set a lastPipeEvent with the same x and y self.ai.data['lastPipeEvent'] = vision.PipeEvent(.5, .5, 0, 0) self.machine.start(pipe.FindAttempt)