示例#1
0
 def test_gets_most_likely_ability(self):
     self.get_sets_mock.return_value = {
         constants.ABILITIES: {
             "immunity": 10,
             "sandveil": 9
         }
     }
     p = Pokemon('gligar', 100)
     p.ability = None
     p.update_ability_for_random_battles()
     self.assertEqual("immunity", p.ability)
示例#2
0
    def test_does_not_exceed_threshold(self):
        p = Pokemon('pikachu', 100)
        p.ability = None

        abilities = [
            ('static', 80),
            ('voltabsorb', 20),
        ]

        possible_items = p.get_possible_abilities(abilities)

        expected_items = ['static']

        self.assertEqual(expected_items, possible_items)
示例#3
0
    def test_gets_multiple_abilities(self):
        p = Pokemon('pikachu', 100)
        p.ability = None

        abilities = [
            ('static', 50),
            ('voltabsorb', 50),
        ]

        possible_items = p.get_possible_abilities(abilities)

        expected_items = ['static', 'voltabsorb']

        self.assertEqual(expected_items, possible_items)
示例#4
0
    def test_gets_revealed_item_when_item_is_revealed(self):
        p = Pokemon('pikachu', 100)
        p.ability = 'static'

        abilities = [
            ('static', 50),
            ('voltabsorb', 50),
        ]

        possible_items = p.get_possible_abilities(abilities)

        expected_items = ['static']

        self.assertEqual(expected_items, possible_items)
示例#5
0
    def test_ignored_ability_in_pass_abilities(self):
        p = Pokemon('pikachu', 100)
        p.ability = None

        abilities = [
            ('static', 50),
            ('pressure', 50),  # pass-ability; it reveals itself so do not guess
        ]

        possible_items = p.get_possible_abilities(abilities)

        expected_items = ['static']

        self.assertEqual(expected_items, possible_items)
示例#6
0
    def test_does_not_get_low_percentage_ability(self):
        p = Pokemon('pikachu', 100)
        p.ability = None

        abilities = [
            ('static', 65),
            ('other_ability1', 5),
            ('other_ability2', 5),
            ('other_ability3', 5),
            ('other_ability4', 5),
            ('other_ability5', 5),
            ('other_ability6', 5),
            ('other_ability7', 5),
        ]

        possible_items = p.get_possible_abilities(abilities)

        expected_items = ['static']

        self.assertEqual(expected_items, possible_items)
示例#7
0
 def test_no_abilities_does_not_error(self):
     self.get_sets_mock.return_value = {constants.ABILITIES: {}}
     p = Pokemon('gligar', 100)
     p.ability = None
     p.update_ability_for_random_battles()
     self.assertEqual(None, p.ability)
示例#8
0
 def test_does_not_get_ability_when_it_exists(self):
     p = Pokemon('pikachu', 100)
     p.ability = "some_ability"
     p.update_ability_for_random_battles()
     self.assertEqual("some_ability", p.ability)
示例#9
0
 def test_gets_item_when_item_is_unknown(self):
     p = Pokemon('pikachu', 100)
     p.ability = None
     p.update_ability_for_random_battles()
     self.assertIsNotNone(p.ability)