forked from hsahovic/poke-env
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_utils.py
136 lines (110 loc) · 3.96 KB
/
test_utils.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
from poke_env import to_id_str, compute_raw_stats
from poke_env.data import GenData
from poke_env.player_configuration import _create_player_configuration_from_player
def test_amoonguss_raw_stats_match_actual_stats():
data = GenData.from_gen(8)
species = to_id_str("Amoonguss")
nature = to_id_str("Timid")
evs = [68, 0, 0, 0, 188, 252]
ivs = [31, 0, 31, 31, 31, 31]
level = 50
actual_stats = [198, 81, 90, 105, 124, 90]
raw_stats = compute_raw_stats(species, evs, ivs, level, nature, data)
assert actual_stats == raw_stats
def test_incineroar_raw_stats_match_actual_stats():
data = GenData.from_gen(8)
species = to_id_str("Incineroar")
nature = to_id_str("Adamant")
evs = [252, 116, 0, 0, 140, 0]
ivs = [31, 31, 31, 31, 31, 28]
level = 50
actual_stats = [202, 165, 110, 90, 128, 79]
raw_stats = compute_raw_stats(species, evs, ivs, level, nature, data)
assert actual_stats == raw_stats
def test_togedemaru_raw_stats_match_actual_stats():
data = GenData.from_gen(8)
species = to_id_str("Togedemaru")
nature = to_id_str("Hasty")
evs = [0, 252, 0, 0, 4, 252]
ivs = [22, 31, 0, 0, 31, 31]
level = 100
actual_stats = [262, 295, 117, 85, 183, 320]
raw_stats = compute_raw_stats(species, evs, ivs, level, nature, data)
assert actual_stats == raw_stats
def test_blissey_raw_stats_match_actual_stats():
data = GenData.from_gen(8)
species = to_id_str("Blissey")
nature = to_id_str("Timid")
evs = [252, 0, 4, 0, 0, 252]
ivs = [31, 31, 31, 31, 31, 31]
level = 100
actual_stats = [714, 50, 57, 186, 306, 229]
raw_stats = compute_raw_stats(species, evs, ivs, level, nature, data)
assert actual_stats == raw_stats
def test_shedinja_raw_stats_match_actual_stats():
data = GenData.from_gen(8)
species = to_id_str("Shedinja")
nature = to_id_str("Adamant")
evs = [0, 252, 4, 0, 0, 252]
ivs = [31, 31, 31, 31, 31, 31]
level = 50
actual_stats = [1, 156, 66, 45, 50, 92]
raw_stats = compute_raw_stats(species, evs, ivs, level, nature, data)
assert actual_stats == raw_stats
level = 100
actual_stats = [1, 306, 127, 86, 96, 179]
raw_stats = compute_raw_stats(species, evs, ivs, level, nature, data)
assert actual_stats == raw_stats
def test_player_configuration_auto_naming():
class ShortPlayer:
pass
class VeryLongPlayerClassName:
pass
assert (
_create_player_configuration_from_player(ShortPlayer()).username
== "ShortPlayer 1"
)
assert (
_create_player_configuration_from_player(ShortPlayer()).username
== "ShortPlayer 2"
)
assert (
_create_player_configuration_from_player(VeryLongPlayerClassName()).username
== "VeryLongPlayerCl 1"
)
assert (
_create_player_configuration_from_player(VeryLongPlayerClassName()).username
== "VeryLongPlayerCl 2"
)
assert (
_create_player_configuration_from_player(VeryLongPlayerClassName()).username
== "VeryLongPlayerCl 3"
)
assert (
_create_player_configuration_from_player(VeryLongPlayerClassName()).username
== "VeryLongPlayerCl 4"
)
assert (
_create_player_configuration_from_player(VeryLongPlayerClassName()).username
== "VeryLongPlayerCl 5"
)
assert (
_create_player_configuration_from_player(VeryLongPlayerClassName()).username
== "VeryLongPlayerCl 6"
)
assert (
_create_player_configuration_from_player(VeryLongPlayerClassName()).username
== "VeryLongPlayerCl 7"
)
assert (
_create_player_configuration_from_player(VeryLongPlayerClassName()).username
== "VeryLongPlayerCl 8"
)
assert (
_create_player_configuration_from_player(VeryLongPlayerClassName()).username
== "VeryLongPlayerCl 9"
)
assert (
_create_player_configuration_from_player(VeryLongPlayerClassName()).username
== "VeryLongPlayerC 10"
)