コード例 #1
0
 def test_002_stat_set_plus(self):
     ev1 = pokemon.StatSet(hp=1)
     ev2 = pokemon.StatSet(hp=2)
     ev3 = ev1 + ev2
     assert ev1.hp == 1
     assert ev2.hp == 2
     assert ev3.hp == 3
コード例 #2
0
 def test_004_pokemon_to_dict(self):
     s = pokemon.Species(1, 'bulbasaur')
     p = pokemon.Pokemon(1, s)
     d = p.to_dict()
     expected = {
         'id': 1,
         'species': 1,
         'nick_name': None,
         'pokerus': False,
         'item': None,
         'evs': pokemon.StatSet().to_dict(),
         'stats': pokemon.StatSet().to_dict(),
         'move_set': None
     }
     assert d == expected
コード例 #3
0
    def test_000_species_search(self):
        mock_pokeapi_calls()

        species = pokemon.Species.search(1)
        assert species.name == 'bulbasaur'
        assert species.id == 1
        assert species.evs == pokemon.StatSet(special_attack=1)
        assert species.types == [
            pokemon.Type(4, 'poison'),
            pokemon.Type(12, 'grass')
        ]
コード例 #4
0
 def test__008_stat_set_to_dict(self):
     ev1 = pokemon.StatSet(hp=2)
     ev_dict = ev1.to_dict()
     excepted_dict = {
         'hp': 2,
         'attack': 0,
         'defense': 0,
         'special_attack': 0,
         'special_defense': 0,
         'speed': 0
     }
     assert ev_dict == excepted_dict
コード例 #5
0
    def test_005_pokemon_from_dict(self):
        mock_pokeapi_calls()

        expected = {
            'id': 1,
            'species': 1,
            'nick_name': 'Boots',
            'pokerus': False,
            'item': 'Macho Brace',
            'evs': pokemon.StatSet().to_dict(),
            'stats': pokemon.StatSet().to_dict(),
            'move_set': None
        }
        p = pokemon.Pokemon.from_dict(expected)
        assert p.name == 'Boots'
        assert p.item == 'Macho Brace'
        assert p.evs == pokemon.StatSet()
        assert p.stats == pokemon.StatSet()
        assert p.species.name == 'bulbasaur'
        assert p.species.id == 1
        assert p.species.evs == pokemon.StatSet(special_attack=1)
コード例 #6
0
 def test_007_stat_set_clone(self):
     ev1 = pokemon.StatSet(hp=2)
     ev2 = ev1.clone()
     assert ev1 == ev2
     assert ev1 is not ev2
コード例 #7
0
 def test_006_stat_set_not_equals(self):
     ev1 = pokemon.StatSet(hp=1)
     ev2 = pokemon.StatSet(hp=2)
     assert ev1 != ev2
コード例 #8
0
 def test_005_stat_set_equals(self):
     ev1 = pokemon.StatSet(hp=2)
     ev2 = pokemon.StatSet(hp=2)
     assert ev1 == ev2
コード例 #9
0
 def test_004_stat_set_times(self):
     ev1 = pokemon.StatSet(hp=2)
     ev2 = ev1 * 3
     assert ev1.hp == 2
     assert ev2.hp == 6
コード例 #10
0
 def test_003_stat_set_times_equal(self):
     ev1 = pokemon.StatSet(hp=2)
     ev1 *= 3
     assert ev1.hp == 6
コード例 #11
0
 def test_001_stat_set_plus_equal(self):
     ev1 = pokemon.StatSet(hp=1)
     ev2 = pokemon.StatSet(hp=2)
     ev1 += ev2
     assert ev1.hp == 3