blob: 6d3b504a20377dbc0bbacc984cae13bc64d48ae3 (
plain)
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
|
"""
Tests for the battle controller
"""
import unittest
from setup_vba import (
vba,
autoplayer,
)
from pokemontools.vba.battle import (
Battle,
BattleException,
)
from bootstrapping import (
bootstrap,
bootstrap_trainer_battle,
)
class BattleTests(unittest.TestCase):
cry = None
vba = None
bootstrap_state = None
@classmethod
def setUpClass(cls):
cls.cry = vba.crystal()
cls.vba = cls.cry.vba
cls.bootstrap_state = bootstrap_trainer_battle()
cls.vba.state = cls.bootstrap_state
@classmethod
def tearDownClass(cls):
cls.vba.shutdown()
def setUp(self):
# reset to whatever the bootstrapper created
self.vba.state = self.bootstrap_state
def test_battle_is_player_turn(self):
self.cry.vba.state = self.bootstrap_state
battle = Battle(emulator=self.cry)
self.assertTrue(battle.is_player_turn())
if __name__ == "__main__":
unittest.main()
|