async def test_end_active_player_turn_no_zombies(): gs = GameState() gs.players = [PlayerShelter(), PlayerShelter(), PlayerShelter()] survivor_card = CityCard(ZombieType.ZOMBIE) survivor_card.flip() for player in gs.players: player.survivors.append(survivor_card) gs.active_player = gs.players[2] gs.supply_deck = [Supply.AXE, Supply.ALARM, Supply.AXE, Supply.GUN] await gs.end_active_player_turn() assert gs.active_player == gs.players[0] assert len(gs.players[2].supplies) == 3
async def test_end_active_player_turn_zombies_no_obstacles(): gs = GameState() gs.players = [PlayerShelter(), PlayerShelter(), PlayerShelter()] survivor_card = CityCard(ZombieType.ZOMBIE) survivor_card.flip() for player in gs.players: player.survivors.append(survivor_card) gs.active_player = gs.players[2] gs.active_player.print = dumper_factory() gs.active_player.supplies = [Supply.AXE, Supply.ALARM] zombie_card = CityCard(ZombieType.ZOMBIE) zombie_card.flip() gs.active_player.zombies = [zombie_card] gs.supply_deck = [Supply.AXE, Supply.ALARM, Supply.AXE, Supply.GUN] await gs.end_active_player_turn() assert gs.active_player == gs.players[0] assert len(gs.players[2].supplies) == 0 assert len(tests.common.outputs) == 2
async def test_end_active_player_turn_zombies_and_alarm( fast_zombie, zombie, big_zombie): gs = GameState() gs.players = [PlayerShelter(), PlayerShelter(), PlayerShelter()] survivor_card = CityCard(ZombieType.ZOMBIE) for player in gs.players: player.survivors.append(survivor_card) survivor_card.flip() gs.city_deck.append(survivor_card) gs.supply_deck = [Supply.AXE, Supply.ALARM, Supply.AXE, Supply.GUN] gs.active_player = gs.players[2] shelter = gs.active_player shelter.obstacles = [Supply.ALARM, Supply.ALARM] shelter.zombies = [fast_zombie, zombie, big_zombie] shelter.print = dumper_factory() shelter.input = helper_factory(['y']) await gs.end_active_player_turn() assert len(shelter.survivors) == 1 assert len(shelter.zombies) == 4 assert len(gs.city_deck) == 0 assert len(shelter.obstacles) == 1 assert len(gs.supply_graveyard) == 1 assert len(shelter.supplies) == 3 assert len(tests.common.outputs) == 7
def fast_zombie(): ret = CityCard(ZombieType.FAST) ret.flip() return ret
def big_zombie(): ret = CityCard(ZombieType.BIG) ret.flip() return ret
def zombie(): ret = CityCard(ZombieType.ZOMBIE) ret.flip() return ret