def test_sets_item_when_it_causes_the_bot_damage(self): split_msg = [ '', '-damage', 'p1a: Kartana', '167/319', '[from] item: Rocky Helmet', '[of] p2a: Ferrothorn' ] heal_or_damage(self.battle, split_msg) self.assertEqual('rockyhelmet', self.battle.opponent.active.item)
def test_sets_ability_when_the_bot_is_damaged_from_opponents_ability(self): split_msg = [ '', '-damage', 'p1a: Lamdorus', '167/319', '[from] ability: Iron Barbs', '[of] p2a: Ferrothorn' ] heal_or_damage(self.battle, split_msg) self.assertEqual('ironbarbs', self.battle.opponent.active.ability)
def test_sets_ability_when_the_information_is_present(self): split_msg = [ '', '-heal', 'p2a: Quagsire', '68/100', '[from] ability: Water Absorb', '[of] p2a: Genesect' ] heal_or_damage(self.battle, split_msg) self.assertEqual('waterabsorb', self.battle.opponent.active.ability)
def test_toxic_count_increases_to_2(self): self.battle.opponent.side_conditions[constants.TOXIC_COUNT] = 1 split_msg = [ '', '-damage', 'p2a: Caterpie', '94/100 tox', '[from] psn' ] heal_or_damage(self.battle, split_msg) self.assertEqual( 2, self.battle.opponent.side_conditions[constants.TOXIC_COUNT])
def test_damage_caused_by_toxic_increases_side_condition_toxic_counter_for_user( self): split_msg = [ '', '-damage', 'p1a: Caterpie', '94/100 tox', '[from] psn' ] heal_or_damage(self.battle, split_msg) self.assertEqual( 1, self.battle.user.side_conditions[constants.TOXIC_COUNT])
def test_does_not_set_item_when_item_is_none(self): # |-heal|p2a: Drifblim|37/100|[from] item: Sitrus Berry split_msg = [ '', '-heal', 'p2a: Drifblim', '37/100', '[from] item: Sitrus Berry' ] self.battle.opponent.active.item = None heal_or_damage(self.battle, split_msg) self.assertEqual(None, self.battle.opponent.active.item)
def test_damage_caused_by_non_toxic_damage_does_not_increase_toxic_count( self): split_msg = [ '', '-damage', 'p2a: Caterpie', '50/100 tox', '[from] item: Life Orb' ] heal_or_damage(self.battle, split_msg) self.assertEqual( 0, self.battle.opponent.side_conditions[constants.TOXIC_COUNT])
def test_damage_caused_by_an_item_properly_sets_opponents_item(self): split_msg = [ '', '-damage', 'p2a: Caterpie', '100/100', '[from] item: Life Orb' ] heal_or_damage(self.battle, split_msg) self.assertEqual("lifeorb", self.battle.opponent.active.item)
def test_fainted_message_properly_faints_opponents_pokemon(self): split_msg = ['', '-damage', 'p2a: Caterpie', '0 fnt'] heal_or_damage(self.battle, split_msg) self.assertEqual(0, self.battle.opponent.active.hp)
def test_damage_sets_opponents_active_pokemon_to_correct_hp(self): split_msg = ['', '-damage', 'p2a: Caterpie', '80/100'] heal_or_damage(self.battle, split_msg) self.assertEqual(160, self.battle.opponent.active.hp)