def test_isalive(self): hero = Hero(name="Stu") self.assertTrue(hero.is_alive()) hero.health = 0 self.assertFalse(hero.is_alive()) hero.health = 100 self.assertTrue(hero.is_alive()) hero.take_damage(102) self.assertFalse(hero.is_alive())
def test_combat(self): hero = Hero() villain = Mob() lib = Librarian() winner = lib.combat_time(hero, villain) # print "WINNER WINNER", winner, villain.is_alive(), hero.is_alive(), hero.health self.assertTrue(hero.is_alive()) self.assertEqual(hero, winner)