Exemplo n.º 1
0
 def setUp(self):
     """ Builds the delegate and pkmn for use in the tests """
     self.pkmn = BuildPokemonBattleWrapper()
     self.status = "PAR"
     attack = Attack()
     attack.type = ""
     self.delegate = ApplyStatusDelegate(attack, self.status, 1)
Exemplo n.º 2
0
class applyStatus(unittest.TestCase):
    """ Test that applyStatus actually applies a status """
    def setUp(self):
        """ Builds the delegate and pkmn for use in the tests """
        self.pkmn = BuildPokemonBattleWrapper()
        self.status = "PAR"
        attack = Attack()
        attack.type = ""
        self.delegate = ApplyStatusDelegate(attack, self.status, 1)

    def appliesStatusUser(self):
        """ Tests if applyStatus applies the staus and returns the method """
        self.delegate.affectUser = 1
        self.delegate.applyStatus(self.pkmn)
        assert self.pkmn.getStatus(
        ).abbr == self.status, "Status should be PAR on the user pkmn"
Exemplo n.º 3
0
 def setUp(self):
     """ Builds the delegate and pkmn for use in the tests """
     self.pkmn = BuildPokemonBattleWrapper()
     self.status = "PAR"
     attack = Attack()
     attack.type = ""
     self.delegate = ApplyStatusDelegate(attack, self.status, 1)
Exemplo n.º 4
0
class applyStatus(unittest.TestCase):
    """ Test that applyStatus actually applies a status """
    
    def setUp(self):
        """ Builds the delegate and pkmn for use in the tests """
        self.pkmn = BuildPokemonBattleWrapper()
        self.status = "PAR"
        attack = Attack()
        attack.type = ""
        self.delegate = ApplyStatusDelegate(attack, self.status, 1)
        
    def appliesStatusUser(self):
        """ Tests if applyStatus applies the staus and returns the method """
        self.delegate.affectUser = 1
        self.delegate.applyStatus(self.pkmn)
        assert self.pkmn.getStatus().abbr == self.status, "Status should be PAR on the user pkmn"
Exemplo n.º 5
0
    def immune(self):
        """ Test an effect that is immune will result in a miss """
        status, message = StatusFactory.buildStatusFromAbbr("PAR")
        self.pkmn.setStatus(status)

        effect = ApplyStatusDelegate(self.parent, "PAR", 1)
        self.buildDelegate(effect)
        assert self.delegate.immune(self.pkmn, None), "Should be immune"
Exemplo n.º 6
0
    def notImmune(self):
        """ Test an effect that is not immune returns correctly  """
        status = Status()
        self.pkmn.setStatus(status)

        effect = ApplyStatusDelegate(self.parent, "PAR", 1)
        self.buildDelegate(effect)
        assert not self.delegate.immune(self.pkmn,
                                        None), "Should not be immune"
Exemplo n.º 7
0
class checkStatusAlready(unittest.TestCase):
    """ Test that checkStatusAlready returns correctly """
    
    def setUp(self):
        """ Builds the delegate and pkmn for use in the tests """
        self.pkmn = BuildPokemonBattleWrapper()
        self.status = "PAR"
        attack = Attack()
        attack.type = ""
        self.delegate = ApplyStatusDelegate(attack, self.status, 1)
        
    def hasStatusAlready(self):
        """ Tests checkStatusAlready returns correctly if the pkmn has a status already """
        self.pkmn.setStatus(Paralysis())
        assert self.delegate.checkStatusAlready(self.pkmn), "Should have a status already"
        
    def hasNoStatusAlready(self):
        """ Tests checkStatusAlready returns correctly if the pkmn has a status already """
        self.pkmn.setStatus(Status())
        assert not self.delegate.checkStatusAlready(self.pkmn), "Should not have a status already"
Exemplo n.º 8
0
class checkStatusAlready(unittest.TestCase):
    """ Test that checkStatusAlready returns correctly """
    def setUp(self):
        """ Builds the delegate and pkmn for use in the tests """
        self.pkmn = BuildPokemonBattleWrapper()
        self.status = "PAR"
        attack = Attack()
        attack.type = ""
        self.delegate = ApplyStatusDelegate(attack, self.status, 1)

    def hasStatusAlready(self):
        """ Tests checkStatusAlready returns correctly if the pkmn has a status already """
        self.pkmn.setStatus(Paralysis())
        assert self.delegate.checkStatusAlready(
            self.pkmn), "Should have a status already"

    def hasNoStatusAlready(self):
        """ Tests checkStatusAlready returns correctly if the pkmn has a status already """
        self.pkmn.setStatus(Status())
        assert not self.delegate.checkStatusAlready(
            self.pkmn), "Should not have a status already"