Exemplo n.º 1
0
class applyEffect(unittest.TestCase):
    """ Test cases of applyEffect """
    def setUp(self):
        """ Build the Effect and Pkmn for the test """
        self.stat1 = "ATK"
        self.stat2 = "DEF"

        self.val1 = 50
        self.val2 = 20

        self.user = BuildPokemonBattleWrapper()
        self.delegate = SwapStatDelegate(self.stat1, self.stat2)

    def swapped(self):
        """ Test that the stats are swapped """
        self.user.setStat(self.stat1, self.val1)
        self.user.setStat(self.stat2, self.val2)
        self.delegate.applyEffect(self.user, None, None)

        assert self.user.getStat(
            self.stat1) == self.val2, "Stat 1 should get Stat 2's value"
        assert self.user.getStat(
            self.stat2) == self.val1, "Stat 2 should get Stat 1's value"

    def message(self):
        """ Test that the message is returned correctly """
        messages = self.delegate.applyEffect(self.user, None, None)

        message = SwapStatDelegate.message % (self.user.getHeader(),
                                              self.stat1, self.stat2)
        assert messages == [
            message
        ], "Message should say the user had its two stats swapped"
Exemplo n.º 2
0
class applyEffect(unittest.TestCase):
    """ Test cases of applyEffect """
    
    def  setUp(self):
        """ Build the Effect and Pkmn for the test """
        self.stat1 = "ATK"
        self.stat2 = "DEF"
        
        self.val1 = 50
        self.val2 = 20
        
        self.user = BuildPokemonBattleWrapper()
        self.delegate = SwapStatDelegate(self.stat1, self.stat2)
        
    def swapped(self):
        """ Test that the stats are swapped """
        self.user.setStat(self.stat1, self.val1)
        self.user.setStat(self.stat2, self.val2)
        self.delegate.applyEffect(self.user, None, None)
        
        assert self.user.getStat(self.stat1) == self.val2, "Stat 1 should get Stat 2's value"
        assert self.user.getStat(self.stat2) == self.val1, "Stat 2 should get Stat 1's value"
        
    def message(self):
        """ Test that the message is returned correctly """
        messages = self.delegate.applyEffect(self.user, None, None)
        
        message = SwapStatDelegate.message % (self.user.getHeader(), self.stat1, self.stat2)
        assert messages == [message], "Message should say the user had its two stats swapped"
Exemplo n.º 3
0
    def setUp(self):
        """ Build the Effect and Pkmn for the test """
        self.stat1 = "ATK"
        self.stat2 = "DEF"

        self.val1 = 50
        self.val2 = 20

        self.user = BuildPokemonBattleWrapper()
        self.delegate = SwapStatDelegate(self.stat1, self.stat2)
Exemplo n.º 4
0
 def  setUp(self):
     """ Build the Effect and Pkmn for the test """
     self.stat1 = "ATK"
     self.stat2 = "DEF"
     
     self.val1 = 50
     self.val2 = 20
     
     self.user = BuildPokemonBattleWrapper()
     self.delegate = SwapStatDelegate(self.stat1, self.stat2)