Beispiel #1
0
 def test_gets_all_moves_when_an_unknown_set_is_there(self):
     self.get_sets_mock.return_value = {
         constants.SETS: {
             "grassknot|hiddenpowerice60|voltswitch|volttackle": 16,
             "grassknot|hiddenpowerice60|irontail|poisonjab": 33
         },
         constants.MOVES: {
             "grassknot": 1,
             "hiddenpowerice60": 1,
             "voltswitch": 1,
             "volttackle": 1,
             "irontail": 1,
             "poisonjab": 1,
         }
     }
     expected_moves = [
         Move("tackle"),
         Move("grassknot"),
         Move("hiddenpowerice60"),
         Move("voltswitch"),
         Move("volttackle"),
         Move("irontail"),
         Move("poisonjab")
     ]
     p = Pokemon('pikachu', 100)
     p.moves = [Move("tackle")]
     p.update_moves_for_random_battles()
     self.assertEqual(expected_moves, p.moves)
Beispiel #2
0
    def test_preserves_previous_moves(self):
        self.get_mega_name_mock.return_value = 'venusaurmega'

        pkmn = Pokemon('venusaur', 100)
        pkmn.moves = [
            {
                '1': '2'
            },
            {
                '3': '4'
            },
            {
                '5': '6'
            },
            {
                '7': '8'
            },
        ]
        pkmn.try_convert_to_mega()
        expected_moves = [
            {
                '1': '2'
            },
            {
                '3': '4'
            },
            {
                '5': '6'
            },
            {
                '7': '8'
            },
        ]
        self.assertEqual(expected_moves, pkmn.moves)
Beispiel #3
0
    def test_chance_moves_are_not_affected_by_known_moves(self):
        p = Pokemon('pikachu', 100)
        p.moves = [Move('tackle')]

        moves = [('move1', 95), ('move2', 40), ('move3', 40), ('move4', 40)]

        moves = p.get_possible_moves(moves)

        expected_result = (['move1'], ['move2', 'move3', 'move4'])

        self.assertEqual(expected_result, moves)
Beispiel #4
0
    def test_gets_only_first_3_moves_when_one_move_is_known(self):
        p = Pokemon('pikachu', 100)
        p.moves = [Move('tackle')]

        moves = [('move1', 95), ('move2', 94), ('move3', 93), ('move4', 92)]

        moves = p.get_possible_moves(moves)

        expected_result = (['move1', 'move2', 'move3'], [])

        self.assertEqual(expected_result, moves)
Beispiel #5
0
    def test_expected_plus_known_does_not_exceed_four_with_chance_moves(self):
        p = Pokemon('pikachu', 100)

        p.moves = [
            Move('tackle'),
            Move('splash'),
            Move('stringshot'),
        ]
        moves = [('move1', 95), ('move2', 80), ('move3', 40), ('move4', 40)]

        moves = p.get_possible_moves(moves)

        expected_result = (['move1'], [])

        self.assertEqual(expected_result, moves)
Beispiel #6
0
    def test_does_not_get_already_revealed_move_and_guesses_expected_moves(
            self):
        p = Pokemon('pikachu', 100)

        p.moves = [
            Move('tackle'),
            Move('stringshot'),
        ]
        moves = [('tackle', 95), ('splash', 85), ('stringshot', 40),
                 ('move4', 40)]

        moves = p.get_possible_moves(moves)

        expected_result = (['splash'], ['move4'])

        self.assertEqual(expected_result, moves)
Beispiel #7
0
    def test_chance_moves_are_not_guessed_if_known_plus_expected_equals_four(
            self):
        p = Pokemon('pikachu', 100)

        p.moves = [
            Move('tackle'),
            Move('splash'),
            Move('stringshot'),
        ]
        moves = [('move1', 95), ('move2', 40), ('move3', 40), ('move4', 40)]

        moves = p.get_possible_moves(moves)

        expected_result = (['move1'], [])

        self.assertEqual(expected_result, moves)
Beispiel #8
0
 def test_gets_only_set_available(self):
     self.get_sets_mock.return_value = {
         constants.SETS: {
             "grassknot|hiddenpowerice60|voltswitch|volttackle": 16,
             "grassknot|hiddenpowerice60|irontail|volttackle": 33
         }
     }
     expected_moves = [
         Move("irontail"),
         Move("grassknot"),
         Move("hiddenpowerice60"),
         Move("volttackle"),
     ]
     p = Pokemon('pikachu', 100)
     p.moves = [Move('irontail')]
     p.update_moves_for_random_battles()
     self.assertEqual(expected_moves, p.moves)
Beispiel #9
0
 def test_gets_all_possible_moves_when_none_have_yet_been_revealed(self):
     self.get_sets_mock.return_value = {
         constants.SETS: {
             "grassknot|hiddenpowerice60|voltswitch|volttackle": 16,
             "grassknot|hiddenpowerice60|irontail|volttackle": 33
         }
     }
     expected_moves = [
         Move("grassknot"),
         Move("hiddenpowerice60"),
         Move("voltswitch"),
         Move("volttackle"),
         Move("irontail")
     ]
     p = Pokemon('pikachu', 100)
     p.moves = list()
     p.update_moves_for_random_battles()
     self.assertEqual(expected_moves, p.moves)
Beispiel #10
0
 def test_gets_combination_of_two_sets_available_but_not_the_third(self):
     self.get_sets_mock.return_value = {
         constants.SETS: {
             "grassknot|hiddenpowerice60|voltswitch|volttackle": 16,
             "grassknot|hiddenpowerice60|irontail|volttackle": 33,
             "tackle|hiddenpowerice60|irontail|volttackle": 33
         }
     }
     expected_moves = [
         Move("grassknot"),
         Move("hiddenpowerice60"),
         Move("voltswitch"),
         Move("volttackle"),
         Move("irontail")
     ]
     p = Pokemon('pikachu', 100)
     p.moves = [Move('grassknot')]
     p.update_moves_for_random_battles()
     self.assertEqual(expected_moves, p.moves)
Beispiel #11
0
 def test_no_new_moves_are_added_when_4_have_been_revealed(self):
     self.get_sets_mock.return_value = {
         constants.SETS: {
             "grassknot|hiddenpowerice60|voltswitch|volttackle": 16,
             "grassknot|hiddenpowerice60|irontail|volttackle": 33,
             "tackle|hiddenpowerice60|irontail|volttackle": 33
         }
     }
     expected_moves = [
         Move("grassknot"),
         Move("hiddenpowerice60"),
         Move("voltswitch"),
         Move("volttackle"),
     ]
     p = Pokemon('pikachu', 100)
     p.moves = [
         Move("grassknot"),
         Move("hiddenpowerice60"),
         Move("voltswitch"),
         Move("volttackle"),
     ]
     p.update_moves_for_random_battles()
     self.assertEqual(expected_moves, p.moves)
Beispiel #12
0
 def test_three_revealed_moves_gets_only_the_possible_sets(self):
     self.get_sets_mock.return_value = {
         constants.SETS: {
             "grassknot|hiddenpowerice60|voltswitch|volttackle": 16,
             "grassknot|hiddenpowerice60|irontail|volttackle": 33,
             "tackle|hiddenpowerice60|irontail|volttackle": 33
         }
     }
     expected_moves = [
         Move('grassknot'),
         Move('hiddenpowerice60'),
         Move('volttackle'),
         Move('voltswitch'),
         Move('irontail'),
     ]
     p = Pokemon('pikachu', 100)
     p.moves = [
         Move('grassknot'),
         Move('hiddenpowerice60'),
         Move('volttackle'),
     ]
     p.update_moves_for_random_battles()
     self.assertEqual(expected_moves, p.moves)