def testGetThirstyAction(self): action_occurrences = xml_stuff.queryXMLForActionBetweenFrames(self.root, "GETTHIRSTY", 4, 19) assert (action_occurrences == 1), "should have had GETTHIRSTY between 4 and 19, but occurred {}".format(action_occurrences)
def testActionOccursOnce(self): action_occurrences = xml_stuff.queryXMLForActionBetweenFrames(self.root,"usecomputer_END",0,1000) assert (action_occurrences == 1), "should have had action usecomputer_END once; n times action occurred: {} [{}]".format(action_occurrences,self.xml_string)
def testActionJustRight(self): action_occurrences = xml_stuff.queryXMLForActionBetweenFrames(self.causal_xml,"standing_START",295,297) assert (action_occurrences), "should have had action at 296; n times action occurred: {}".format(action_occurrences)
def testNotIncorrectAction(self): action_occurrences = xml_stuff.queryXMLForActionBetweenFrames(self.root,"FLIPSWITCH",0,15) action_occurrences += xml_stuff.queryXMLForActionBetweenFrames(self.root,"A3",0,15) action_occurrences += xml_stuff.queryXMLForActionBetweenFrames(self.root,"A4",0,15) assert (not action_occurrences), "should not have had action FLIPSWITCH, A3, A4; n times action occurred: {}".format(action_occurrences)
def testCorrectAction(self): start = 527 end = 551 action_occurrences = xml_stuff.queryXMLForActionBetweenFrames(self.root,"usecomputer_END",start,end) assert (action_occurrences == 1), "should have had action usecomputer_END between {} and {}; n times action occurred: {} [{}]".format(start,end,action_occurrences,self.xml_string)
def testCorrectAction(self): action_occurrences = xml_stuff.queryXMLForActionBetweenFrames(self.root,"A2",0,15) assert (action_occurrences == 1), "should have had action A2; n times action occurred: {}".format(action_occurrences)
def testActionTooLate(self): action_occurrences = xml_stuff.queryXMLForActionBetweenFrames(self.root,"FLIPSWITCH",5,15) assert (not action_occurrences), "should have had no action after 5; n times action occurred: {}".format(action_occurrences)
def testActionJustRight(self): action_occurrences = xml_stuff.queryXMLForActionBetweenFrames(self.root,"FLIPSWITCH",4,6) assert (action_occurrences), "should have had action at 5; n times action occurred: {}".format(action_occurrences)
def testActionTooEarly(self): #queryXMLForActionBetweenFrames(xml,action,frame1,frame2) action_occurrences = xml_stuff.queryXMLForActionBetweenFrames(self.root,"FLIPSWITCH",0,5) assert (not action_occurrences), "should have had no action before 5; n times action occurred: {}".format(action_occurrences)
def testActionAt25(self): action_occurrences = xml_stuff.queryXMLForActionBetweenFrames(self.root,"FLIPSWITCH",24,26) assert (action_occurrences), "should have had action at 25; n times action occurred: {}".format(action_occurrences) assert (action_occurrences < 2), "should have had action at 25; n times action occurred: {}".format(action_occurrences)