本文整理汇总了Python中monster.Monster.reset方法的典型用法代码示例。如果您正苦于以下问题:Python Monster.reset方法的具体用法?Python Monster.reset怎么用?Python Monster.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类monster.Monster
的用法示例。
在下文中一共展示了Monster.reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MonsterResetTest
# 需要导入模块: from monster import Monster [as 别名]
# 或者: from monster.Monster import reset [as 别名]
class MonsterResetTest(unittest.TestCase):
def setUp(self):
self.monsta = Monster()
print(self.shortDescription())
def test_valid_health_reset(self):
"""
Tests for valid health reset
"""
self.monsta.health = 5
self.monsta.reset()
expected = 10
actual = self.monsta.health
assertEqual(expected, actual)
def test_valid_victory_reset(self):
"""
Tests for valid victory point reset
"""
self.monsta.victory_points = 5
self.monsta.reset()
expected = 0
actual = self.monsta.victory_points
assertEqual(expected, actual)
示例2: test_reset
# 需要导入模块: from monster import Monster [as 别名]
# 或者: from monster.Monster import reset [as 别名]
def test_reset(self):
"""Set status to "Oops", health to -200 and victory_points to 90 on
a Monster class object, new_monster. Call reset() then check that
new_monster's status, health and victory_points attributes were
restored to their initial values."""
new_monster = Monster("Cookie")
new_monster.status = "Oops"
new_monster.health = -200
new_monster.victory_points = 90
new_monster.reset()
self.assertEqual(new_monster.status, "Out of Tokyo")
self.assertEqual(new_monster.health, 10)
self.assertEqual(new_monster.victory_points, 0)
del new_monster