class TestMonsterInTokyo(unittest.TestCase): def setUp(self): """ Initializes the monster for the following testing functions. """ self.monster = Monster("Cereal Killer") def tearDown(self): """ Delete the instance of monster after running tests. """ del self.monster def test_monster_if_in_tokyo(self): """ Determine if monster in Tokyo """ self.monster.status = "in Tokyo" self.monster.in_tokyo() self.assertTrue(True, self.monster.status) def test_monster_if_out_of_tokyo(self): """ Determine if monster Out of Tokyo """ self.monster.status = "Out of Tokyo" self.monster.in_tokyo() self.assertFalse(False, self.monster.status)
class TestMonsterReset(unittest.TestCase): def setUp(self): """ Initializes the monster for the following testing functions. """ self.monster = Monster("Cereal Killer") def tearDown(self): """ Delete the instance of monster after running tests. """ del self.monster def test_reset_status_to_out_of_tokyo(self): """ Reset status to initial value "Out of Tokyo". """ self.monster.status = "in Tokyo" self.monster.reset() self.assertEqual("Out of Tokyo", self.monster.status, "reset status to 'Out of Tokyo'") def test_reset_health_to_10(self): """ Reset health to initial value 10. """ self.monster.health = 20 self.monster.reset() self.assertEqual(10, self.monster.health, "reset health to 10") def test_reset_victory_points_to_0(self): """ Reset victory_points to initial value zero. """ self.monster.victory_points = 20 self.monster.reset() self.assertEqual(0, self.monster.victory_points, "reset victory_points to 0")
def traveling_screen(self): monster = Monster() hero_back = pygame.image.load(self.choosen_hero.back_img) displayloop = True while displayloop: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() quit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_w: print "KLIKNALEM w" self.random_screen(monster) elif event.key == pygame.K_a: self.random_screen(monster) elif event.key == pygame.K_d: self.random_screen(monster) elif event.key == pygame.K_i: self.inventory_screen() smallText = pygame.font.Font("Pixeled.ttf", 12) gameDisplay.fill(black) gameDisplay.blit(hud, (0, 400)) gameDisplay.blit(hero_back, (50, 200)) firstsurf, firstrect = text_objects("[w] Travel North", smallText, red) firstrect.center = (150, 470) gameDisplay.blit(firstsurf, firstrect) seconfsurf, seconfrect = text_objects("[d] Travel East", smallText, red) seconfrect.center = (150, 500) gameDisplay.blit(seconfsurf, seconfrect) thirdsurf, thirdrect = text_objects("[a] Travel West", smallText, red) thirdrect.center = (150, 530) gameDisplay.blit(thirdsurf, thirdrect) forthsurf, forthrect = text_objects("[i] Inventory", smallText, red) forthrect.center = (570, 470) gameDisplay.blit(forthsurf, forthrect) self.hero_stats(smallText) pygame.display.update()
def setUp(self): """ Initializes the monster for the following testing functions. """ self.monster = Monster("Cereal Killer")