Example #1
0
class applyLock(unittest.TestCase):
    """ Test cases of applyLock """
    def setUp(self):
        """ Build the Delegate for the test """
        self.user = BuildPokemonBattleWrapper()
        self.lastAction = 2
        self.user.lastAction = self.lastAction

        self.turns = 2
        self.delegate = MultiTurnDelegate(None)
        self.delegate.turns = self.turns

        self.delegate.applyLock(self.user)
        self.actionLock = self.user.actionLock

    def parent(self):
        """ Test that the parent is the effect's user """
        assert self.actionLock.parent == self.user, "Lock's parent should be the using Pkmn"

    def action(self):
        """ Test that the action is the user's last action """
        assert self.actionLock.action == self.lastAction, "Lock's action should be the user's last action"

    def turnsToGo(self):
        """ Test that the turnsToGo are the effect's turns - 1 """
        assert self.actionLock.turnsToGo == self.turns - 1, "Lock's turns to go should be effect's turns -1 since the effect has actually already done one of its chain"
Example #2
0
class applyLock(unittest.TestCase):
    """ Test cases of applyLock """
    
    def  setUp(self):
        """ Build the Delegate for the test """
        self.user = BuildPokemonBattleWrapper()
        self.lastAction = 2
        self.user.lastAction = self.lastAction
        
        self.turns = 2
        self.delegate = MultiTurnDelegate(None)
        self.delegate.turns = self.turns
        
        self.delegate.applyLock(self.user)
        self.actionLock = self.user.actionLock
        
    def parent(self):
        """ Test that the parent is the effect's user """
        assert self.actionLock.parent == self.user, "Lock's parent should be the using Pkmn"
        
    def action(self):
        """ Test that the action is the user's last action """
        assert self.actionLock.action == self.lastAction, "Lock's action should be the user's last action"
        
    def turnsToGo(self):
        """ Test that the turnsToGo are the effect's turns - 1 """
        assert self.actionLock.turnsToGo == self.turns -1, "Lock's turns to go should be effect's turns -1 since the effect has actually already done one of its chain"
Example #3
0
    def setUp(self):
        """ Build the Delegate for the test """
        self.effect = BuildEffectDelegate()
        effects = [self.effect]

        self.turns = 2
        self.delegate = MultiTurnDelegate(effects)
        self.delegate.turns = self.turns
Example #4
0
    def setUp(self):
        """ Build the Delegate for the test """
        self.user = BuildPokemonBattleWrapper()
        self.lastAction = 2
        self.user.lastAction = self.lastAction

        self.turns = 2
        self.delegate = MultiTurnDelegate(None)
        self.delegate.turns = self.turns

        self.delegate.applyLock(self.user)
        self.actionLock = self.user.actionLock
Example #5
0
class resetTurns(unittest.TestCase):
    """ Test cases of resetTurns """
    def setUp(self):
        """ Build the Delegate for the test """
        self.effect = BuildEffectDelegate()
        effects = [self.effect]

        self.turns = 2
        self.delegate = MultiTurnDelegate(effects)
        self.delegate.turns = self.turns

    def turnOn(self):
        """ Test that turnOn is reset """
        self.delegate.turnOn = 1
        self.delegate.resetTurns()
        assert self.delegate.turnOn == 0, "Turn On should be reset"
Example #6
0
class resetTurns(unittest.TestCase):
    """ Test cases of resetTurns """
    
    def  setUp(self):
        """ Build the Delegate for the test """
        self.effect = BuildEffectDelegate()
        effects = [self.effect]
        
        self.turns = 2
        self.delegate = MultiTurnDelegate(effects)
        self.delegate.turns = self.turns
        
    def turnOn(self):
        """ Test that turnOn is reset """
        self.delegate.turnOn = 1
        self.delegate.resetTurns()
        assert  self.delegate.turnOn == 0, "Turn On should be reset"
Example #7
0
 def  setUp(self):
     """ Build the Delegate for the test """
     self.effect = BuildEffectDelegate()
     effects = [self.effect]
     
     self.turns = 2
     self.delegate = MultiTurnDelegate(effects)
     self.delegate.turns = self.turns
Example #8
0
class incTurns(unittest.TestCase):
    """ Test cases of incTurns """
    def setUp(self):
        """ Build the Delegate for the test """
        self.turns = 2
        self.delegate = MultiTurnDelegate(None)
        self.delegate.turns = self.turns

    def inc(self):
        """ Test that the turnOn is incremented """
        self.delegate.turnOn = 0
        self.delegate.incTurns()

        assert self.delegate.turnOn == 1, "Turn should be incremented"

    def wrapAround(self):
        """ Test that the turnOn wraps around to 0 when it hits the turn count """
        self.delegate.turnOn = self.turns - 1
        self.delegate.incTurns()

        assert self.delegate.turnOn == 0, "Turn should wrap around to 0"
Example #9
0
 def  setUp(self):
     """ Build the Delegate for the test """
     self.user = BuildPokemonBattleWrapper()
     self.lastAction = 2
     self.user.lastAction = self.lastAction
     
     self.turns = 2
     self.delegate = MultiTurnDelegate(None)
     self.delegate.turns = self.turns
     
     self.delegate.applyLock(self.user)
     self.actionLock = self.user.actionLock
Example #10
0
class incTurns(unittest.TestCase):
    """ Test cases of incTurns """
    
    def  setUp(self):
        """ Build the Delegate for the test """
        self.turns = 2
        self.delegate = MultiTurnDelegate(None)
        self.delegate.turns = self.turns
        
    def inc(self):
        """ Test that the turnOn is incremented """
        self.delegate.turnOn = 0
        self.delegate.incTurns()
        
        assert self.delegate.turnOn == 1, "Turn should be incremented"
        
    def wrapAround(self):
        """ Test that the turnOn wraps around to 0 when it hits the turn count """
        self.delegate.turnOn = self.turns - 1
        self.delegate.incTurns()
        
        assert self.delegate.turnOn == 0, "Turn should wrap around to 0"
Example #11
0
class checkOver(unittest.TestCase):
    """ Test cases of checkOver """
    
    def  setUp(self):
        """ Build the Delegate for the test """
        self.effect = BuildEffectDelegate()
        effects = [self.effect]
        
        self.turns = 2
        self.delegate = MultiTurnDelegate(effects)
        self.delegate.turns = self.turns
        
    def notOver(self):
        """ Test that the the effects are not called when the effect is not over """
        self.delegate.turnOn = 1
        messages = self.delegate.checkOver(None, None)
        assert messages == [], "If the effect is not over, the effects should not be called"
        
    def over(self):
        """ Test that the the effects are called when the effect is over """
        self.delegate.turnOn = 0
        messages = self.delegate.checkOver(None, None)
        assert messages == [self.effect.message], "Should get the messages from the effects"
Example #12
0
class checkOver(unittest.TestCase):
    """ Test cases of checkOver """
    def setUp(self):
        """ Build the Delegate for the test """
        self.effect = BuildEffectDelegate()
        effects = [self.effect]

        self.turns = 2
        self.delegate = MultiTurnDelegate(effects)
        self.delegate.turns = self.turns

    def notOver(self):
        """ Test that the the effects are not called when the effect is not over """
        self.delegate.turnOn = 1
        messages = self.delegate.checkOver(None, None)
        assert messages == [], "If the effect is not over, the effects should not be called"

    def over(self):
        """ Test that the the effects are called when the effect is over """
        self.delegate.turnOn = 0
        messages = self.delegate.checkOver(None, None)
        assert messages == [self.effect.message
                            ], "Should get the messages from the effects"
Example #13
0
 def setUp(self):
     """ Build the Delegate for the test """
     self.turns = 2
     self.delegate = MultiTurnDelegate(None)
     self.delegate.turns = self.turns
Example #14
0
 def  setUp(self):
     """ Build the Delegate for the test """
     self.turns = 2
     self.delegate = MultiTurnDelegate(None)
     self.delegate.turns = self.turns
Example #15
0
 def __init__(self, turns, effects):
     """ Builds a Fixed Multi Turn Effect that will perform the given effects when it ends """
     self.turns = turns
     MultiTurnDelegate.__init__(self, effects)
 def __init__(self, min, max, effects):
     """ Builds a Multi Turn Effect that will perform the given effects when it ends """
     self.min = min
     self.max = max
     
     MultiTurnDelegate.__init__(self, effects)
Example #17
0
 def resetTurns(self):
     """ Reset the Turns left for the effect """
     self.getTurns()
     MultiTurnDelegate.resetTurns(self)
 def __init__(self, turns, effects):
     """ Builds a Fixed Multi Turn Effect that will perform the given effects when it ends """
     self.turns = turns
     MultiTurnDelegate.__init__(self, effects)
Example #19
0
    def __init__(self, min, max, effects):
        """ Builds a Multi Turn Effect that will perform the given effects when it ends """
        self.min = min
        self.max = max

        MultiTurnDelegate.__init__(self, effects)
 def resetTurns(self):
     """ Reset the Turns left for the effect """
     self.getTurns()
     MultiTurnDelegate.resetTurns(self)