class Check_stats_when_reset(unittest.TestCase): def setUp(self): self.monster_game = Monster() def tearDown(self): del self.monster_game def test_stats(self): """If the currentstage is 2, the health is 3 and the victory points are 2. if you call reset it should reset to the starting stats""" self.monster_game.currentstage = 2 self.monster_game.health = 3 self.monster_game.victory_points = 2 self.monster_game.reset() self.assertEqual(self.monster_game.current_status, 1) self.assertEqual(self.monster_game.health, 10) self.assertEqual(self.monster_game.victory_points, 0) def test_stats(self): """ Same as above but with numbers tha you shouldn't be able to have """ self.monster_game.currentstage = 25 self.monster_game.health = 60 self.monster_game.victory_points = 60 self.monster_game.reset() self.assertEqual(self.monster_game.current_status, 1) self.assertEqual(self.monster_game.health, 10) self.assertEqual(self.monster_game.victory_points, 0)
class Check_in_tokyo(unittest.TestCase): def setUp(self): self.monster_game = Monster() def tearDown(self): del self.monster_game def test_if_in_tokyo(self): self.monster_game.current_status, 1 self.monster_game.in_tokyo() self.assertFalse(self.monster_game.In_Tokyo, False)
class Check_attack(unittest.TestCase): def setUp(self): self.monster = Monster() def tearDown(self): del self.monster def test_subtraction_works(self): self.monster.health = 3 self.monster.attack(5) self.assertNotEqual(self.monster.health, 3)
class Check_heal(unittest.TestCase): def setUp(self): self.monster = Monster() def tearDown(self): del self.monster def test_if_heal_works_under_ten(self): self.monster.health = 3 self.monster.heal(5) self.assertEqual(self.monster.health, 8) def test_if_heal_works_above_ten(self): self.monster.health = 6 self.monster.heal(5) self.assertEqual(self.monster.health, 10)
def setUp(self): self.monster = Monster()
def setUp(self): self.monster_game = Monster()