def test_switch_resets_toxic_count_for_user(self): self.battle.user.side_conditions[constants.TOXIC_COUNT] = 1 split_msg = ['', 'switch', 'p1a: weedle', 'Weedle, L100, M', '100/100'] switch_or_drag(self.battle, split_msg) self.assertEqual( 0, self.battle.user.side_conditions[constants.TOXIC_COUNT])
def test_switch_resets_toxic_count_for_opponent_when_there_is_no_toxic_count( self): split_msg = ['', 'switch', 'p2a: weedle', 'Weedle, L100, M', '100/100'] switch_or_drag(self.battle, split_msg) self.assertEqual( 0, self.battle.opponent.side_conditions[constants.TOXIC_COUNT])
def test_switch_opponents_pokemon_successfully_creates_new_pokemon_for_active( self): new_pkmn = Pokemon('weedle', 100) split_msg = ['', 'switch', 'p2a: weedle', 'Weedle, L100, M', '100/100'] switch_or_drag(self.battle, split_msg) self.assertEqual(new_pkmn, self.battle.opponent.active)
def test_existing_boosts_on_opponents_active_pokemon_are_cleared_when_switching( self): self.opponent_active.boosts[constants.ATTACK] = 1 self.opponent_active.boosts[constants.SPEED] = 1 split_msg = ['', 'switch', 'p2a: weedle', 'Weedle, L100, M', '100/100'] switch_or_drag(self.battle, split_msg) self.assertEqual({}, self.opponent_active.boosts)
def test_already_seen_pokemon_is_the_same_object_as_the_one_in_the_reserve( self): already_seen_pokemon = Pokemon('weedle', 100) self.battle.opponent.reserve.append(already_seen_pokemon) split_msg = ['', 'switch', 'p2a: weedle', 'Weedle, L100, M', '100/100'] switch_or_drag(self.battle, split_msg) self.assertIs(already_seen_pokemon, self.battle.opponent.active)
def test_switch_into_already_seen_pokemon_does_not_create_a_new_pokemon( self): already_seen_pokemon = Pokemon('weedle', 100) self.battle.opponent.reserve.append(already_seen_pokemon) split_msg = ['', 'switch', 'p2a: weedle', 'Weedle, L100, M', '100/100'] switch_or_drag(self.battle, split_msg) self.assertEqual(1, len(self.battle.opponent.reserve))
def test_switching_into_the_same_pokemon_does_not_put_that_pokemon_in_the_reserves( self): # this is specifically for Zororak split_msg = [ '', 'switch', 'p2a: caterpie', 'Caterpie, L100, M', '100/100' ] switch_or_drag(self.battle, split_msg) self.assertFalse(self.battle.opponent.reserve)
def test_existing_boosts_on_bots_active_pokemon_are_cleared_when_switching( self): pkmn = self.battle.user.active pkmn.boosts[constants.ATTACK] = 1 pkmn.boosts[constants.SPEED] = 1 split_msg = ['', 'switch', 'p1a: pidgey', 'Pidgey, L100, M', '100/100'] switch_or_drag(self.battle, split_msg) self.assertEqual({}, pkmn.boosts)
def test_arceus_ghost_switching_in(self): already_seen_pokemon = Pokemon('arceus', 100) self.battle.opponent.reserve.append(already_seen_pokemon) split_msg = ['', 'switch', 'p2a: Arceus', 'Arceus-Ghost', '100/100'] switch_or_drag(self.battle, split_msg) expected_pokemon = Pokemon('arceus-ghost', 100) self.assertEqual(expected_pokemon, self.battle.opponent.active)
def test_silvally_steel_replaces_silvally(self): already_seen_pokemon = Pokemon('silvally', 100) self.battle.opponent.reserve.append(already_seen_pokemon) split_msg = [ '', 'switch', 'p2a: silvally', 'Silvally-Steel, L100, M', '100/100' ] switch_or_drag(self.battle, split_msg) expected_pokemon = Pokemon('silvallysteel', 100) self.assertEqual(expected_pokemon, self.battle.opponent.active)
def test_multiple_forme_changes_does_not_ruin_base_name(self): self.battle.user.active = Pokemon('pikachu', 100) self.battle.opponent.active = Pokemon('pikachu', 100) self.battle.opponent.reserve = [] self.battle.opponent.reserve.append(Pokemon('wishiwashi', 100)) m1 = [ '', 'switch', 'p2a: Wishiwashi', 'Wishiwashi, L100, M', '100/100' ] m2 = [ '', '-formechange', 'p2a: Wishiwashi', 'Wishiwashi-School', '', '[from] ability: Schooling' ] m3 = ['', 'switch', 'p2a: Pikachu', 'Pikachu, L100, M', '100/100'] m4 = [ '', 'switch', 'p2a: Wishiwashi', 'Wishiwashi, L100, M', '100/100' ] m5 = [ '', '-formechange', 'p2a: Wishiwashi', 'Wishiwashi-School', '', '[from] ability: Schooling' ] m6 = ['', 'switch', 'p2a: Pikachu', 'Pikachu, L100, M', '100/100'] m7 = [ '', 'switch', 'p2a: Wishiwashi', 'Wishiwashi, L100, M', '100/100' ] m8 = [ '', '-formechange', 'p2a: Wishiwashi', 'Wishiwashi-School', '', '[from] ability: Schooling' ] switch_or_drag(self.battle, m1) form_change(self.battle, m2) switch_or_drag(self.battle, m3) switch_or_drag(self.battle, m4) form_change(self.battle, m5) switch_or_drag(self.battle, m6) switch_or_drag(self.battle, m7) form_change(self.battle, m8) pkmn = Pokemon("wishiwashischool", 100) self.assertNotIn(pkmn, self.battle.opponent.reserve)
def test_switch_opponents_pokemon_creates_reserve_of_length_1_when_reserve_was_previously_empty( self): split_msg = ['', 'switch', 'p2a: weedle', 'Weedle, L100, M', '100/100'] switch_or_drag(self.battle, split_msg) self.assertEqual(1, len(self.battle.opponent.reserve))
def test_switch_opponents_pokemon_successfully_places_previous_active_pokemon_in_reserve( self): split_msg = ['', 'switch', 'p2a: weedle', 'Weedle, L100, M', '100/100'] switch_or_drag(self.battle, split_msg) self.assertIn(self.opponent_active, self.battle.opponent.reserve)