Ejemplo n.º 1
0
    def test_load_json(self, _pokemon_json_file):
        bulbizarre = Pokemon.from_json(_pokemon_json_file)

        assert bulbizarre.code == 1
        assert bulbizarre.number == 1
        assert bulbizarre.name == "Bulbizarre"
        assert bulbizarre.level == 30
        assert bulbizarre.health == 221
        assert bulbizarre.attack == 103
        assert bulbizarre.defense == 117
        assert bulbizarre.special_attack == 162
        assert bulbizarre.special_defense == 169
        assert bulbizarre.speed == 96
        assert bulbizarre.total == 868
        assert bulbizarre.iv == [21, 0, 14, 27, 19, 12]
        assert bulbizarre.ev == [0, 0, 0, 0, 0, 0]
        assert bulbizarre.accuracy == 1.0
        assert bulbizarre.dodge == 1.0
Ejemplo n.º 2
0
def _attacker_pokemon() -> Pokemon:
    return Pokemon.from_json(CURRENT_DIR / "inputs" / "bulbizarre.json")
Ejemplo n.º 3
0
    def test_write_read_json(self, tmp_path):
        random_pikachu = Pokemon.generate_random("Pikachu", 25)
        random_pikachu.to_json(tmp_path / "save.json")

        read_pikachu = Pokemon.from_json(tmp_path / "save.json")
        assert read_pikachu == random_pikachu