class doAction(unittest.TestCase): """ Test cases of doAction """ def setUp(self): """ Build the Switch Action for the test """ self.action = SwitchAction(self, None) self.calledSendOutPkmn = False def sendOutPkmnCalled(self): """ Test that the priority returned is the Switch Action Priority """ self.action.doAction() self.assertTrue(self.calledSendOutPkmn, "Should have called the sendOutPkmn method") def sendOutPkmn(self, pkmnToSwitchTo): self.calledSendOutPkmn = True
def setAction(self, entry): """ Set the Chosen Action """ if self.canSwitchTo(entry.getPokemon()): self.action = SwitchAction(self.pokemon, entry.getPokemon()) self.stopRunning() else: """ Tell Screen to display message that the pokemon cannot be used """
def setAction(self, entry): """ Set the Chosen Action """ if self.pokemon.isPokemon(entry.getPokemon()): self.runController(MessageBoxController(BattleMessage("{0} is already out.".format(self.pokemon.name)), self.screen)) elif entry.getPokemon().fainted(): self.runController(MessageBoxController(BattleMessage("{0} has no will to fight.".format(entry.getPokemon().name)), self.screen)) else: self.action = SwitchAction(self.pokemon, entry.getPokemon()) self.stopRunning()
class getPriority(unittest.TestCase): """ Test cases of getPriority """ def setUp(self): """ Build the Switch Action for the test """ self.action = SwitchAction(None, None) def switchValue(self): """ Test that the priority returned is the Switch Action Priority """ priority = self.action.getPriority() self.assertEquals(priority, SwitchAction.PRIORITY, "Priority should be the Switch Action Priority")
def setSwitchAction(self, entry): """ Set the Switch Action """ if not self.pkmn.isPokemon(entry.getPokemon()): self.action = SwitchAction(self.pkmn, entry.getPokemon())
def setUp(self): """ Build the Switch Action for the test """ self.action = SwitchAction(None, None)
def setUp(self): """ Build the Switch Action for the test """ self.action = SwitchAction(self, None) self.calledSendOutPkmn = False