Beispiel #1
0
class applyEffect(unittest.TestCase):
    """ Test cases of applyEffect """
    
    def  setUp(self):
        """ Build the Pkmn and Delegate for the test """
        self.user = BuildPokemonBattleWrapper()
        self.target = BuildPokemonBattleWrapper()
        self.delegate = ConfuseDelegate(1)
        
    def alreadyConfused(self):
        """ Test that confusion is not applied when the target is already confused """
        self.user.secondaryEffects = [Confusion()]
        message = self.user.getHeader() + Confusion.already
        messages = self.delegate.applyEffect(self.user, self.target, None)
        
        assert len(messages) == 1, "Should get one message"
        assert messages[0]  == message, "Should say that the Pkmn is already confused"
        
        assert len(self.user.secondaryEffects) == 1, "Pkmn should not get another confusion effect"
        
    def notConfused(self):
        """ Test that confusion is applied when the target is not confused """
        self.user.secondaryEffects = []
        message = self.user.getHeader() + Confusion.start
        messages = self.delegate.applyEffect(self.user, self.target, None)
        
        assert len(messages) == 1, "Should get one message"
        assert messages[0]  == message, "Should say that the Pkmn is now confused"
        
        assert len(self.user.secondaryEffects) == 1, "Pkmn should get a confusion effect"
        assert self.delegate.isConfused(self.user), "The Pkmn should now be confused"
Beispiel #2
0
class applyEffect(unittest.TestCase):
    """ Test cases of applyEffect """
    def setUp(self):
        """ Build the Pkmn and Delegate for the test """
        self.user = BuildPokemonBattleWrapper()
        self.target = BuildPokemonBattleWrapper()
        self.delegate = ConfuseDelegate(1)

    def alreadyConfused(self):
        """ Test that confusion is not applied when the target is already confused """
        self.user.secondaryEffects = [Confusion()]
        message = self.user.getHeader() + Confusion.already
        messages = self.delegate.applyEffect(self.user, self.target, None)

        assert len(messages) == 1, "Should get one message"
        assert messages[
            0] == message, "Should say that the Pkmn is already confused"

        assert len(self.user.secondaryEffects
                   ) == 1, "Pkmn should not get another confusion effect"

    def notConfused(self):
        """ Test that confusion is applied when the target is not confused """
        self.user.secondaryEffects = []
        message = self.user.getHeader() + Confusion.start
        messages = self.delegate.applyEffect(self.user, self.target, None)

        assert len(messages) == 1, "Should get one message"
        assert messages[
            0] == message, "Should say that the Pkmn is now confused"

        assert len(self.user.secondaryEffects
                   ) == 1, "Pkmn should get a confusion effect"
        assert self.delegate.isConfused(
            self.user), "The Pkmn should now be confused"