本文整理汇总了Python中Test.test_helper.BuildPokemonBattleWrapper.getStat方法的典型用法代码示例。如果您正苦于以下问题:Python BuildPokemonBattleWrapper.getStat方法的具体用法?Python BuildPokemonBattleWrapper.getStat怎么用?Python BuildPokemonBattleWrapper.getStat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test.test_helper.BuildPokemonBattleWrapper
的用法示例。
在下文中一共展示了BuildPokemonBattleWrapper.getStat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: applyEffect
# 需要导入模块: from Test.test_helper import BuildPokemonBattleWrapper [as 别名]
# 或者: from Test.test_helper.BuildPokemonBattleWrapper import getStat [as 别名]
class applyEffect(unittest.TestCase):
""" Test cases of applyEffect """
def setUp(self):
""" Build the Effect and Pkmn for the test """
self.stat1 = "ATK"
self.stat2 = "DEF"
self.val1 = 50
self.val2 = 20
self.user = BuildPokemonBattleWrapper()
self.delegate = SwapStatDelegate(self.stat1, self.stat2)
def swapped(self):
""" Test that the stats are swapped """
self.user.setStat(self.stat1, self.val1)
self.user.setStat(self.stat2, self.val2)
self.delegate.applyEffect(self.user, None, None)
assert self.user.getStat(self.stat1) == self.val2, "Stat 1 should get Stat 2's value"
assert self.user.getStat(self.stat2) == self.val1, "Stat 2 should get Stat 1's value"
def message(self):
""" Test that the message is returned correctly """
messages = self.delegate.applyEffect(self.user, None, None)
message = SwapStatDelegate.message % (self.user.getHeader(), self.stat1, self.stat2)
assert messages == [message], "Message should say the user had its two stats swapped"
示例2: afterTurn
# 需要导入模块: from Test.test_helper import BuildPokemonBattleWrapper [as 别名]
# 或者: from Test.test_helper.BuildPokemonBattleWrapper import getStat [as 别名]
class afterTurn(unittest.TestCase):
""" Test that afterTurn works correctly """
def setUp(self):
""" Builds the Paralysis status"""
self.status = Burn()
self.pkmn = BuildPokemonBattleWrapper()
def damage(self):
""" Test that the damage is done correctly """
self.pkmn.setStat("HP", 32)
self.pkmn.setCurrHP(32)
self.status.afterTurn(self.pkmn)
damage = self.pkmn.getStat("HP") - self.pkmn.getCurrHP()
assert damage == self.pkmn.getRatioOfHealth(Burn.ratio), "Damage should be Burn Ratio of Health"
def message(self):
""" Test that the message is returned correctly """
messages = self.status.afterTurn(self.pkmn)
message = self.pkmn.getHeader() + Burn.intermittent
assert len(messages) == 1, "Should get one message"
assert messages[0] == message, "Message should be that the Pkmn was damaged by the Burn"