def test_end_illusion(): logger = MagicMock() battle = Battle("tag", "username", logger) empty_boosts = { "accuracy": 0, "atk": 0, "def": 0, "evasion": 0, "spa": 0, "spd": 0, "spe": 0, } non_empty_boosts = { "accuracy": 1, "atk": 0, "def": -2, "evasion": 3, "spa": 5, "spd": -6, "spe": 2, } battle._player_role = "p2" battle._switch("p2: Celebi", "Celebi", "100/100") battle._switch("p1: Kingdra", "Kingdra, F", "100/100") battle.active_pokemon._boosts = non_empty_boosts assert battle.active_pokemon.species == "celebi" battle._parse_message(["", "replace", "p2: Zoroark", "Zoroark, M"]) assert battle.active_pokemon.species == "zoroark" assert battle.opponent_active_pokemon.species == "kingdra" assert battle.get_pokemon("p2: Zoroark").boosts == non_empty_boosts assert battle.get_pokemon("p2: Celebi").boosts == empty_boosts
def test_battle_get_pokemon(): logger = MagicMock() battle = Battle("tag", "username", logger) battle.get_pokemon("p2: azumarill", force_self_team=True) assert "p2: azumarill" in battle.team battle._player_role = "p2" battle._parse_message(["", "teamsize", "p1", 6]) battle._parse_message(["", "teamsize", "p2", 6]) battle.get_pokemon("p2a: tapukoko") assert "p2: tapukoko" in battle.team battle.get_pokemon("p1: hydreigon", details="Hydreigon, F") assert "p1: hydreigon" in battle.opponent_team assert battle.get_pokemon("p2: tapufini").species == "tapufini" assert battle.get_pokemon("p2: tapubulu").types == ( PokemonType.GRASS, PokemonType.FAIRY, ) assert battle.get_pokemon("p2: tapulele").base_stats == { "atk": 85, "def": 75, "hp": 70, "spa": 130, "spd": 115, "spe": 95, } battle.get_pokemon("p2: yveltal") assert len(battle.team) == 6 with pytest.raises(ValueError): print(battle.get_pokemon("p2: pikachu")) assert "p2: pikachu" not in battle.team