class getCritChance(unittest.TestCase):
    """ Test cases of getCritChance """
    
    def  setUp(self):
        """ Build the CritDelegate and Pkmn for the test """
        self.pkmn = BuildPokemonBattleWrapper()
        self.crit = CritDelegate(0)
        
    def checkMods(self):
        """ Test that mods affect the crit chance correctly """
        self.crit = CritDelegate(0)
        
        for mod in range(0, len(CritDelegate.critMods)):
            self.pkmn.statMods["CRT"] = mod
            chance = self.crit.getCritChance(self.pkmn)
            assert chance == CritDelegate.critMods[mod], "The Pkmn's crit mod should get the corresponding crit chance"
            
    def checkBase(self):
        """ Test that base affect the crit chance correctly """
        self.pkmn.statMods["CRT"] = 0
        
        for base in range(0, len(CritDelegate.critMods)):
            crit = CritDelegate(base)
            chance = crit.getCritChance(self.pkmn)
            assert chance == CritDelegate.critMods[base], "The Crit Delegate's base should get the corresponding crit chance"
            
    def checkBaseAndMod(self):
        """ Test that base and mod compound correctly """
        base = 2
        mod = 2
        
        self.crit = CritDelegate(base)
        self.pkmn.statMods["CRT"] = mod
        chance = self.crit.getCritChance(self.pkmn)
        assert chance == CritDelegate.critMods[base+mod], "The base and mod should compound to get the crit chance"
 def checkBase(self):
     """ Test that base affect the crit chance correctly """
     self.pkmn.statMods["CRT"] = 0
     
     for base in range(0, len(CritDelegate.critMods)):
         crit = CritDelegate(base)
         chance = crit.getCritChance(self.pkmn)
         assert chance == CritDelegate.critMods[base], "The Crit Delegate's base should get the corresponding crit chance"
示例#3
0
    def checkBase(self):
        """ Test that base affect the crit chance correctly """
        self.pkmn.statMods["CRT"] = 0

        for base in range(0, len(CritDelegate.critMods)):
            crit = CritDelegate(base)
            chance = crit.getCritChance(self.pkmn)
            assert chance == CritDelegate.critMods[
                base], "The Crit Delegate's base should get the corresponding crit chance"
示例#4
0
class getCritChance(unittest.TestCase):
    """ Test cases of getCritChance """
    def setUp(self):
        """ Build the CritDelegate and Pkmn for the test """
        self.pkmn = BuildPokemonBattleWrapper()
        self.crit = CritDelegate(0)

    def checkMods(self):
        """ Test that mods affect the crit chance correctly """
        self.crit = CritDelegate(0)

        for mod in range(0, len(CritDelegate.critMods)):
            self.pkmn.statMods["CRT"] = mod
            chance = self.crit.getCritChance(self.pkmn)
            assert chance == CritDelegate.critMods[
                mod], "The Pkmn's crit mod should get the corresponding crit chance"

    def checkBase(self):
        """ Test that base affect the crit chance correctly """
        self.pkmn.statMods["CRT"] = 0

        for base in range(0, len(CritDelegate.critMods)):
            crit = CritDelegate(base)
            chance = crit.getCritChance(self.pkmn)
            assert chance == CritDelegate.critMods[
                base], "The Crit Delegate's base should get the corresponding crit chance"

    def checkBaseAndMod(self):
        """ Test that base and mod compound correctly """
        base = 2
        mod = 2

        self.crit = CritDelegate(base)
        self.pkmn.statMods["CRT"] = mod
        chance = self.crit.getCritChance(self.pkmn)
        assert chance == CritDelegate.critMods[
            base +
            mod], "The base and mod should compound to get the crit chance"