def  setUp(self):
     """ Build the FaintDelegate for the test """
     self.handler = SourceFaintDelegate()
     self.source = BuildPokemonBattleWrapper()
     self.user = BuildPokemonBattleWrapper()
     self.effect = BuildEffectDelegate()
     
     self.effect.source = self.source
     self.user.secondaryEffects.append(self.effect)
class removeEffect(unittest.TestCase):
    """ Test cases of removeEffect """
    
    def  setUp(self):
        """ Build the FaintDelegate for the test """
        self.handler = SourceFaintDelegate()
        self.source = BuildPokemonBattleWrapper()
        self.user = BuildPokemonBattleWrapper()
        self.effect = BuildEffectDelegate()
        
        self.effect.source = self.source
        self.user.secondaryEffects.append(self.effect)
        
    def removed(self):
        """ Test that it can't handle the user fainting """
        self.handler.removeEffect(self.user, self.effect)
        assert not self.effect in self.user.secondaryEffects, "The effect should be removed from the user"
class cantHandle(unittest.TestCase):
    """ Test cases of cantHandle """
    
    def  setUp(self):
        """ Build the FaintDelegate for the test """
        self.handler = SourceFaintDelegate()
        self.source = BuildPokemonBattleWrapper()
        self.user = BuildPokemonBattleWrapper()
        self.effect = BuildEffectDelegate()
        
        self.effect.source = self.source
        self.user.secondaryEffects.append(self.effect)
        
    def userFainted(self):
        """ Test that it can't handle the user fainting """
        self.user.faint()
        cantHandle = self.handler.cantHandle(user = self.user, effect = self.effect)
        assert cantHandle, "Shouldn't handle when the user is fainted"
        assert self.effect in self.user.secondaryEffects, "The effect shouldnot be removed from the user"
        
    def userNotFainted(self):
        """ Test that it can handle when the user is not fainted """
        cantHandle = self.handler.cantHandle(user = self.user, effect = self.effect)
        assert not cantHandle, "Should handle when the user is not fainted"
        assert self.effect in self.user.secondaryEffects, "The effect should not be removed from the user"
        
    def sourceFainted(self):
        """ Test that it can't handle the source fainting """
        self.source.faint()
        cantHandle = self.handler.cantHandle(user = self.user, effect = self.effect)
        assert cantHandle, "Shouldn't handle when the source is fainted"
        assert not self.effect in self.user.secondaryEffects, "The effect should be removed from the user"
        
    def sourceNotFainted(self):
        """ Test that it can handle when the user is not fainted """
        cantHandle = self.handler.cantHandle(user = self.user, effect = self.effect)
        assert not cantHandle, "Should handle when the source is not fainted"
        assert self.effect in self.user.secondaryEffects, "The effect should not be removed from the user"