forked from hsahovic/poke-env
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_data.py
71 lines (48 loc) · 2.23 KB
/
test_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import pytest
from poke_env.data import GenData
from poke_env.environment import PokemonType
def test_types_correspond_to_type_chart_entries():
type_chart = GenData.from_gen(8).type_chart
for type_1 in list(PokemonType):
if type_1 in {PokemonType.THREE_QUESTION_MARKS, PokemonType.STELLAR}:
continue
assert type_1.name in type_chart
for type_2 in list(PokemonType):
if type_2 in {PokemonType.THREE_QUESTION_MARKS, PokemonType.STELLAR}:
continue
assert type_2.name in type_chart
for type_ in type_chart.keys():
assert PokemonType[type_] is not None
def test_some_type_weaknesses():
type_chart = GenData.from_gen(8).type_chart
assert type_chart["WATER"]["WATER"] == 0.5
assert type_chart["DRAGON"]["FIRE"] == 0.5
assert type_chart["DRAGON"]["ELECTRIC"] == 0.5
def test_some_type_strengths():
type_chart = GenData.from_gen(8).type_chart
assert type_chart["FIRE"]["WATER"] == 2
assert type_chart["DRAGON"]["DRAGON"] == 2
assert type_chart["WATER"]["ELECTRIC"] == 2
def test_some_type_immunities():
type_chart = GenData.from_gen(8).type_chart
assert type_chart["FLYING"]["GROUND"] == 0
assert type_chart["FAIRY"]["DRAGON"] == 0
assert type_chart["GROUND"]["ELECTRIC"] == 0
def test_gen_data_from_gen_is_unique():
for gen in range(1, 9):
assert GenData.from_gen(gen) == GenData.from_gen(gen)
def test_gen_data_from_format():
assert GenData.from_format("gen1ou") == GenData.from_gen(1)
assert GenData.from_format("gen2randombattle") == GenData.from_gen(2)
assert GenData.from_format("gen3uber") == GenData.from_gen(3)
assert GenData.from_format("gen4ou") == GenData.from_gen(4)
assert GenData.from_format("gen5randombattle") == GenData.from_gen(5)
assert GenData.from_format("gen6ou") == GenData.from_gen(6)
assert GenData.from_format("gen7randombattle") == GenData.from_gen(7)
assert GenData.from_format("gen8doubleou") == GenData.from_gen(8)
assert GenData.from_format("gen9doubleou") == GenData.from_gen(9)
def test_cant_init_same_gen_twice():
for gen in range(1, 9):
GenData.from_gen(gen)
with pytest.raises(ValueError):
GenData(gen=gen)