本文整理汇总了Python中Test.test_helper.BuildPokemonBattleWrapper.getAbility方法的典型用法代码示例。如果您正苦于以下问题:Python BuildPokemonBattleWrapper.getAbility方法的具体用法?Python BuildPokemonBattleWrapper.getAbility怎么用?Python BuildPokemonBattleWrapper.getAbility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test.test_helper.BuildPokemonBattleWrapper
的用法示例。
在下文中一共展示了BuildPokemonBattleWrapper.getAbility方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: applyEffect
# 需要导入模块: from Test.test_helper import BuildPokemonBattleWrapper [as 别名]
# 或者: from Test.test_helper.BuildPokemonBattleWrapper import getAbility [as 别名]
class applyEffect(unittest.TestCase):
""" Test cases of applyEffect """
def setUp(self):
""" Build the Pkmn, Abilities and Effect for the test """
self.user = BuildPokemonBattleWrapper()
self.target = BuildPokemonBattleWrapper()
self.userAbility = Ability(None)
self.targetAbility = Ability(None)
self.user.setAbility(self.userAbility)
self.target.setAbility(self.targetAbility)
self.delegate = SwapAbilityDelegate()
def swapped(self):
""" Test that the abilities are swapped """
self.delegate.applyEffect(self.user, self.target, None)
assert self.user.getAbility() is self.targetAbility, "User should have target's ability"
assert self.target.getAbility() is self.userAbility, "Target should have user's ability"
def message(self):
""" Test message is returned correctly """
messages = self.delegate.applyEffect(self.user, self.target, None)
assert messages == [SwapAbilityDelegate.message % (self.user.getHeader(), self.target.getHeader())], "Should have the Effect's message"
示例2: perform
# 需要导入模块: from Test.test_helper import BuildPokemonBattleWrapper [as 别名]
# 或者: from Test.test_helper.BuildPokemonBattleWrapper import getAbility [as 别名]
class perform(unittest.TestCase):
""" Test cases of perform """
def setUp(self):
""" Build the Step for the test """
self.attack = Attack()
self.step = HandleContactStep(self.attack)
self.user = BuildPokemonBattleWrapper()
self.target = BuildPokemonBattleWrapper()
self.user.getAbility().onContact = self.onContact
self.target.getAbility().onContact = self.onContact
self.hitPkmn = None
self.calledOnContact = 0
self.messages = ["My Test Message"]
def makesContact(self):
""" Test that when the attack makes contact the targets contact effect is used """
self.attack.makes_contact = True
messages = self.step.perform(self.user, self.target, None)
self.assertIs(self.target, self.hitPkmn, "Should have called onContact for the Target Pkmn")
self.assertEquals(1, self.calledOnContact, "Should have called onContact only once")
self.assertEquals(self.messages, messages, "Should receive messages from the onContact")
def doesNotMakeContact(self):
""" Test that when the attack does not make contact nothing happens """
self.attack.makes_contact = False
messages = self.step.perform(self.user, self.target, None)
self.assertEquals(0, self.calledOnContact, "Should not have called onContact")
self.assertEquals([], messages, "Should receive no messages")
def onContact(self, pkmnHit, pkmnWhoAttacked):
self.hitPkmn = pkmnHit
self.calledOnContact += 1
return self.messages
示例3: perform
# 需要导入模块: from Test.test_helper import BuildPokemonBattleWrapper [as 别名]
# 或者: from Test.test_helper.BuildPokemonBattleWrapper import getAbility [as 别名]
class perform(unittest.TestCase):
""" Test cases of perform """
def setUp(self):
""" Build the Step for the test """
self.attack = Attack()
self.originalPowerPointsValue = 10
self.attack.currPowerPoints = self.originalPowerPointsValue
self.step = RemovePPStep(self.attack)
self.target = BuildPokemonBattleWrapper()
self.target.getAbility().powerPointsPressure = self.powerPointsPressure
self.pressure = 2
self.usedAbility = False
def standard(self):
""" Test that the PP is decreased under normal circumstances """
ppValue = 10
self.attack.currPowerPoints = ppValue
self.step.perform(None, self.target, None)
self.assertTrue(self.usedAbility, "PP Pressure should have been determined by the Target's Pressure")
self.assertEquals(ppValue-self.pressure, self.attack.currPowerPoints, "PP should have been reduced by the Target's Pressure")
def hitSelf(self):
""" Test that the PP is decreased under normal circumstances """
self.attack.hitDelegate = HitSelfDelegate()
ppValue = 10
self.attack.currPowerPoints = ppValue
self.step.perform(None, self.target, None)
self.assertFalse(self.usedAbility, "PP Pressure should not have been determined by the Target's Pressure")
self.assertEquals(ppValue-1, self.attack.currPowerPoints, 'PP should have been reduced by 1')
def zero(self):
""" Test that the PP is not decreased when already at zero """
ppValue = 0
self.attack.currPowerPoints = ppValue
self.step.perform(None, self.target, None)
self.assertEquals(0, self.attack.currPowerPoints, 'PP should stay at 0')
def powerPointsPressure(self):
""" Return the power Point Pressure """
self.usedAbility = True
return self.pressure