def test_positive_integers(self, invalid_pokemon_code, invalid_pokemon_number): with pytest.raises(ValidationError): _ = Pokemon( code=invalid_pokemon_code, number=37.0, name="Goupix", level=15, health=38.0, attack="41", defense=40.0, special_attack=50.0, special_defense=65.0, speed=65.0, ) with pytest.raises(ValidationError): _ = Pokemon( code=5, number=invalid_pokemon_number, name="Goupix", level=15, health=38.0, attack="41", defense=40.0, special_attack=50.0, special_defense=65.0, speed=65.0, )
def test_attributes_conversions(self): poke = Pokemon( code="50", number=37.0, name="Goupix", level=15, health=38.0, attack="41", defense=40.0, special_attack=50.0, special_defense=65.0, speed=65.0, ) assert isinstance(poke.code, int) assert isinstance(poke.number, int) assert isinstance(poke.name, str) assert isinstance(poke.level, int) assert isinstance(poke.health, int) assert isinstance(poke.attack, int) assert isinstance(poke.defense, int) assert isinstance(poke.special_attack, int) assert isinstance(poke.special_defense, int) assert isinstance(poke.speed, int) assert isinstance(poke.total, int) assert isinstance(poke.iv, list) assert isinstance(poke.ev, list) assert isinstance(poke.accuracy, float) assert isinstance(poke.dodge, float)
def test_total(self): poke = Pokemon( code=50, number=37, name="Goupix", level=15, health=38, attack=41, defense=40, special_attack=50, special_defense=65, speed=65, ) assert poke.total == 299