def test_random_spawn_location_with_no_candidates(self): grid = self._generate_grid(1, 1) map = WorldMap(grid) grid[Location(0, 0)].avatar = True with self.assertRaises(IndexError): map.get_random_spawn_location()
def test_random_spawn_location(self): cell = MockCell() map = WorldMap({Location(0, 0): cell}) self.assertEqual(map.get_random_spawn_location(), cell.location)
def test_random_spawn_location_with_no_candidates(self): cell = MockCell() map = WorldMap([[cell]]) cell.avatar = 'true' with self.assertRaises(IndexError): map.get_random_spawn_location()
def test_random_spawn_location_successful(self): cell = MockCell() world_map = WorldMap({Location(0, 0): cell}, self.settings) self.assertEqual(world_map.get_random_spawn_location(), cell.location)