Example #1
0
 def setUp(self):
     """ Build the BattleSides and weather for the test """
     self.message = "Some Message"
     self.weather = Weather()
     self.weather.betweenRoundsMessage = self.message
     self.playerSide = BuildBattleSide()
     self.opponentSide = BuildBattleSide()
Example #2
0
 def withMessage(self):
     """ Test that addRoundMessage adds the Weather's between rounds message """
     messages = []
     message = "Some Message"
     weather = Weather()
     weather.betweenRoundsMessage = message
     weather.addRoundMessage(messages)
     assert messages == [message], "Should receive the weather's betweenRoundsMessage"
Example #3
0
 def withMessage(self):
     """ Test that addRoundMessage adds the Weather's between rounds message """
     messages = []
     message = "Some Message"
     weather = Weather()
     weather.betweenRoundsMessage = message
     weather.addRoundMessage(messages)
     assert messages == [
         message
     ], "Should receive the weather's betweenRoundsMessage"
Example #4
0
 def  setUp(self):
     """ Build the BattleSides and weather for the test """
     self.message = "Some Message"
     self.weather = Weather()
     self.weather.betweenRoundsMessage = self.message
     self.playerSide = BuildBattleSide()
     self.opponentSide = BuildBattleSide()
Example #5
0
 def performWeatherEffectOnPokemon(self, pokemon):
     """ Performs the weather's effect on the Pokemon """
     messages = []
     if not self.immune(pokemon):
         messages.append("{0} was buffeted by the hail.".format(pokemon.getName()))
         messages += pokemon.takeRatioOfHealthAsDamage(16)
     messages += Weather.performWeatherEffectOnPokemon(self, pokemon)
     return messages
Example #6
0
 def performWeatherEffectOnPokemon(self, pokemon):
     """ Performs the weather's effect on the Pokemon """
     messages = []
     if not self.immune(pokemon):
         messages.append("{0} was buffeted by the hail.".format(
             pokemon.getName()))
         messages += pokemon.takeRatioOfHealthAsDamage(16)
     messages += Weather.performWeatherEffectOnPokemon(self, pokemon)
     return messages
Example #7
0
class performWeatherEffectOnPokemon(unittest.TestCase):
    """ Test cases of performWeatherEffectOnPokemon """
    def setUp(self):
        """ Build the Pokemon Battle Wrapper and weather for the test """
        self.weather = Weather()
        self.pkmn = BuildPokemonBattleWrapper()

    def performWeatherEffectOnPokemonMessage(self):
        """ Test that performWeatherEffectOnPokemon returns the Weather's between turns message """
        messages = self.weather.performWeatherEffectOnPokemon(self.pkmn)
        assert messages == [], "Should receive an empty between turn message for each Pokemon"
Example #8
0
class performWeatherEffectOnPokemon(unittest.TestCase):
    """ Test cases of performWeatherEffectOnPokemon """
    
    def  setUp(self):
        """ Build the Pokemon Battle Wrapper and weather for the test """
        self.weather = Weather()
        self.pkmn = BuildPokemonBattleWrapper()
        
    def performWeatherEffectOnPokemonMessage(self):
        """ Test that performWeatherEffectOnPokemon returns the Weather's between turns message """
        messages = self.weather.performWeatherEffectOnPokemon(self.pkmn)
        assert messages == [], "Should receive an empty between turn message for each Pokemon"
Example #9
0
class over(unittest.TestCase):
    """ Test cases of over """
    def setUp(self):
        """ Build the BattleSides and weather for the test """
        self.weather = Weather()

    def noTurnsLeft(self):
        """ Test that over returns true when there are no turns left """
        self.weather.forever = False
        self.weather.turnsLeft = 0
        assert self.weather.over(
        ), "Weather should be over when there are no turns left"

    def noTurnsLeftAfterDecrement(self):
        """ Test that over returns true when there are no turns left """
        self.weather.forever = False
        self.weather.turnsLeft = 1
        assert self.weather.over(
        ), "Weather should be over when there are no turns left"

    def turnsLeft(self):
        """ Test that over returns false when there are turns left """
        self.weather.forever = False
        self.weather.turnsLeft = 3
        assert not self.weather.over(
        ), "Weather should not be over when there are turns left"

    def foreverAndTurnsLeft(self):
        """ Test that over returns false when forever is set and there are still turns left """
        self.weather.forever = True
        self.weather.turnsLeft = 4
        assert not self.weather.over(
        ), "Weather should not be over when it is set to last forever"

    def foreverAndNoTurnsLeft(self):
        """ Test that over returns false when forever is set and there are no turns left """
        self.weather.forever = True
        self.weather.turnsLeft = 0
        assert not self.weather.over(
        ), "Weather should not be over when it is set to last forever"
Example #10
0
class over(unittest.TestCase):
    """ Test cases of over """
    
    def  setUp(self):
        """ Build the BattleSides and weather for the test """
        self.weather = Weather()
    
    def noTurnsLeft(self):
        """ Test that over returns true when there are no turns left """
        self.weather.forever = False
        self.weather.turnsLeft = 0
        assert self.weather.over(), "Weather should be over when there are no turns left"
    
    def noTurnsLeftAfterDecrement(self):
        """ Test that over returns true when there are no turns left """
        self.weather.forever = False
        self.weather.turnsLeft = 1
        assert self.weather.over(), "Weather should be over when there are no turns left"
    
    def turnsLeft(self):
        """ Test that over returns false when there are turns left """
        self.weather.forever = False
        self.weather.turnsLeft = 3
        assert not self.weather.over(), "Weather should not be over when there are turns left"
        
    def foreverAndTurnsLeft(self):
        """ Test that over returns false when forever is set and there are still turns left """
        self.weather.forever = True
        self.weather.turnsLeft = 4
        assert not self.weather.over(), "Weather should not be over when it is set to last forever"
    
    def foreverAndNoTurnsLeft(self):
        """ Test that over returns false when forever is set and there are no turns left """
        self.weather.forever = True
        self.weather.turnsLeft = 0
        assert not self.weather.over(), "Weather should not be over when it is set to last forever"
Example #11
0
class betweenRounds(unittest.TestCase):
    """ Test cases of betweenRounds """
    
    def  setUp(self):
        """ Build the BattleSides and weather for the test """
        self.message = "Some Message"
        self.weather = Weather()
        self.weather.betweenRoundsMessage = self.message
        self.playerSide = BuildBattleSide()
        self.opponentSide = BuildBattleSide()
        
    def betweenRoundsMessage(self):
        """ Test that betweenRounds returns the Weather's between rounds message """
        messages = self.weather.betweenRounds(self.playerSide, self.opponentSide)
        assert messages == [self.message], "Should receive the weather's betweenRounds message"
Example #12
0
class betweenRounds(unittest.TestCase):
    """ Test cases of betweenRounds """
    def setUp(self):
        """ Build the BattleSides and weather for the test """
        self.message = "Some Message"
        self.weather = Weather()
        self.weather.betweenRoundsMessage = self.message
        self.playerSide = BuildBattleSide()
        self.opponentSide = BuildBattleSide()

    def betweenRoundsMessage(self):
        """ Test that betweenRounds returns the Weather's between rounds message """
        messages = self.weather.betweenRounds(self.playerSide,
                                              self.opponentSide)
        assert messages == [
            self.message
        ], "Should receive the weather's betweenRounds message"
Example #13
0
 def  setUp(self):
     """ Build the Pokemon Battle Wrapper and weather for the test """
     self.weather = Weather()
     self.pkmn = BuildPokemonBattleWrapper()
Example #14
0
 def __init__(self, overCallbackFunction=None, turns=-1, forever=True):
     """ Build the Hail Weather """
     Weather.__init__(self,
                      overCallbackFunction=overCallbackFunction,
                      turns=turns,
                      forever=forever)
Example #15
0
 def noMessage(self):
     """ Test that addRoundMessage does not add a message when the Weather has no between rounds message """
     messages = []
     weather = Weather()
     weather.addRoundMessage(messages)
     assert messages == [], "Should receive no message when the Weather object has no message"
Example #16
0
 def setUp(self):
     """ Build the Pokemon Battle Wrapper and weather for the test """
     self.weather = Weather()
     self.pkmn = BuildPokemonBattleWrapper()
Example #17
0
 def setUp(self):
     """ Build the BattleSides and weather for the test """
     self.weather = Weather()
Example #18
0
 def  setUp(self):
     """ Build the BattleSides and weather for the test """
     self.weather = Weather()
Example #19
0
 def __init__(self, overCallbackFunction=None, turns=-1, forever=True):
     """ Build the Hail Weather """
     Weather.__init__(self, overCallbackFunction=overCallbackFunction, turns=turns, forever=forever)
Example #20
0
 def noMessage(self):
     """ Test that addOverMessage does not add a message when the Weather has no between rounds message """
     messages = []
     weather = Weather()
     weather.addOverMessage(messages)
     assert messages == [], "Should receive no message when the Weather object has no message"