class hasThisTrap(unittest.TestCase):
    """ Test that hasThisTrap actually returns when it has that type of trap """
    def setUp(self):
        """ Builds the delegate and side for use in the tests """
        self.pkmn = BuildPokemonBattleWrapper()
        self.delegate = TrapDelegate("", "", "")
        self.trap = Trap(None, "", "")
        self.otherTrap = Trap(None, "other.", "")

    def hasTrap(self):
        """ Tests if hasThisTrap returns true when there is an object of this trap """
        self.pkmn.secondaryEffects = [self.trap]

        assert self.delegate.hasThisTrap(
            self.pkmn), "Should have a trap effect"

    def noTrap(self):
        """ Tests if hasThisTrap returns false when there is no trap """
        self.pkmn.secondaryEffects = []

        assert not self.delegate.hasThisTrap(
            self.pkmn), "Should not have a trap effect"

    def otherTrap(self):
        """ Tests if hasThisTrap returns false when there is a different trap """
        self.pkmn.secondaryEffects = [self.otherTrap]

        assert not self.delegate.hasThisTrap(
            self.pkmn
        ), "Should not have a trap effect if there is a different trap effect there"
Esempio n. 2
0
class hasThisTrap(unittest.TestCase):
    """ Test that hasThisTrap actually returns when it has that type of trap """
    
    def setUp(self):
        """ Builds the delegate and side for use in the tests """
        self.pkmn = BuildPokemonBattleWrapper()
        self.delegate = TrapDelegate("", "", "")
        self.trap = Trap(None, "", "")
        self.otherTrap = Trap(None, "other.", "")
        
    def hasTrap(self):
        """ Tests if hasThisTrap returns true when there is an object of this trap """
        self.pkmn.secondaryEffects = [self.trap]
        
        assert self.delegate.hasThisTrap(self.pkmn), "Should have a trap effect"
        
    def noTrap(self):
        """ Tests if hasThisTrap returns false when there is no trap """
        self.pkmn.secondaryEffects = []
        
        assert not self.delegate.hasThisTrap(self.pkmn), "Should not have a trap effect"
        
    def otherTrap(self):
        """ Tests if hasThisTrap returns false when there is a different trap """
        self.pkmn.secondaryEffects = [self.otherTrap]
        
        assert not self.delegate.hasThisTrap(self.pkmn), "Should not have a trap effect if there is a different trap effect there"
class applyEffect(unittest.TestCase):
    """ Test that applyEffect actually adds a trap effect """
    def setUp(self):
        """ Builds the delegate and side for use in the tests """
        self.pkmn = BuildPokemonBattleWrapper()
        self.delegate = TrapDelegate("", "", "")

    def appliesTrap(self):
        """ Tests if applyEffect applies the trap """
        self.pkmn.secondaryEffects = []
        self.delegate.applyEffect(None, self.pkmn, None)

        assert isinstance(self.pkmn.secondaryEffects[0],
                          Trap), "Should have a trap effect"
class removePreviousTrap(unittest.TestCase):
    """ Test that removePreviousTrap actually removes a trap effect """
    def setUp(self):
        """ Builds the delegate and side for use in the tests """
        self.pkmn = BuildPokemonBattleWrapper()
        self.delegate = TrapDelegate("", "", "")
        self.trap = Trap(None, "", "")

    def removeTrap(self):
        """ Tests if the trap is removed """
        self.pkmn.secondaryEffects = [self.trap]
        self.delegate.removePreviousTrap(self.pkmn)

        assert not self.trap in self.pkmn.secondaryEffects, "Should have removed original trap effect"
Esempio n. 5
0
class applyEffect(unittest.TestCase):
    """ Test that applyEffect actually adds a trap effect """
    
    def setUp(self):
        """ Builds the delegate and side for use in the tests """
        self.pkmn = BuildPokemonBattleWrapper()
        self.delegate = TrapDelegate("", "", "")
        
    def appliesTrap(self):
        """ Tests if applyEffect applies the trap """
        self.pkmn.secondaryEffects = []
        self.delegate.applyEffect(None, self.pkmn, None)
        
        assert isinstance(self.pkmn.secondaryEffects[0], Trap), "Should have a trap effect"
Esempio n. 6
0
class removePreviousTrap(unittest.TestCase):
    """ Test that removePreviousTrap actually removes a trap effect """
    
    def setUp(self):
        """ Builds the delegate and side for use in the tests """
        self.pkmn = BuildPokemonBattleWrapper()
        self.delegate = TrapDelegate("", "", "")
        self.trap = Trap(None, "", "")
        
    def removeTrap(self):
        """ Tests if the trap is removed """
        self.pkmn.secondaryEffects = [self.trap]
        self.delegate.removePreviousTrap(self.pkmn)
        
        assert not self.trap in self.pkmn.secondaryEffects, "Should have removed original trap effect"
 def setUp(self):
     """ Builds the delegate and side for use in the tests """
     self.pkmn = BuildPokemonBattleWrapper()
     self.delegate = TrapDelegate("", "", "")
Esempio n. 8
0
 def setUp(self):
     """ Builds the delegate and side for use in the tests """
     self.pkmn = BuildPokemonBattleWrapper()
     self.delegate = TrapDelegate("", "", "")