def test_setOrder(self):
        path = pathlib.Path('myParty.json')
        card_dex = PokeCardDex(path.absolute())

        name_order = [
            'Chikorita',
            'Doduo',
            'Skarmory',
            'Clefable',
            'Weezing',
            'Mareep',
            'Machoke',
            'Persian',
            'Chansey',
        ]

        card_dex.set_order(name_order)
        for name, poke in zip(name_order, card_dex.party):
            self.assertEqual(name, poke.name)
    def test_healPokemon(self):
        path = pathlib.Path('myParty.json')
        card_dex = PokeCardDex(path.absolute())

        expected_hp = [
            60,
            40,
            90,
            80,
            40,
            50,
            70,
            70,
            80
        ]

        for poke in card_dex.party:
              poke.hp = 15

        card_dex.heal_party()

        for hp, poke in zip(expected_hp, card_dex.party):
            self.assertEqual(hp, poke.hp)
Exemple #3
0
    def test_initWithJson(self):
        path = pathlib.Path('myParty.json')
        card_dex = PokeCardDex(path.absolute())

        poke_names = [
            'Skarmory',
            'Mareep',
            'Chansey',
            'Machoke',
            'Chikorita',
            'Doduo',
            'Clefable',
            'Persian',
            'Weezing',
        ]

        self.assertEqual(len(poke_names), len(card_dex.party))

        for pokemon in card_dex.party:
            self.assertIn(pokemon.name, poke_names)
    def test_initAndAttrs(self):
        required_attributes = ['party', 'set_order', 'battle', 'heal_party', 'add_to_party']

        card_dex = PokeCardDex()
        for req_attr in required_attributes:
            self.assertIn(req_attr, dir(card_dex))