Esempio n. 1
0
 def test_dict_operations(self):
     name = "Bulbasaur"
     type1 = "Grass"
     type2 = "Poison"
     hp = 45  # should become 123
     attack = 49  # should become 72
     defense = 49  # should become 72
     spatk = 65  # should become 88
     spdef = 65  # should become 88
     speed = 45  # should become 68
     bulba = Pokemon(name, type1, type2, hp, attack, defense, spatk, spdef,
                     speed)
     newbulba = Pokemon.from_dict(bulba.to_dict(), calcstat=False)
     self.assertTrue(bulba.compare(newbulba))
Esempio n. 2
0
 def from_dict(cls, d, calculate_stat):
     pokemon = []
     for d in d['pokemon']:
         pokemon.append(Pokemon.from_dict(d, calcstat=calculate_stat))
     return cls(pokemon, name=d['name'])