diff options
| author | Bryan Bishop <kanzure@gmail.com> | 2013-11-09 15:45:03 -0600 | 
|---|---|---|
| committer | Bryan Bishop <kanzure@gmail.com> | 2013-11-09 15:45:03 -0600 | 
| commit | 3868fb1e0622e5d3cda0c093ce3114c485fd0096 (patch) | |
| tree | 184fc43668e7bfda64105693debeb36b9f3b9254 /tests/test_vba_battle.py | |
| parent | 54e2b189b8b9765d17d4c0d05675ac70c2bec2ac (diff) | |
simplify the vba-related tests
The imports for the emulator-related tests are now simplified in the
tests/ folder. The bootstrapping.py file contains some shared functions
that multiple test files might choose to use. Those functions probably
belong in the actual module instead of in tests/.
The battle-related tests have been separated from the other emulator
tests.
Diffstat (limited to 'tests/test_vba_battle.py')
| -rw-r--r-- | tests/test_vba_battle.py | 51 | 
1 files changed, 51 insertions, 0 deletions
| diff --git a/tests/test_vba_battle.py b/tests/test_vba_battle.py new file mode 100644 index 0000000..6d3b504 --- /dev/null +++ b/tests/test_vba_battle.py @@ -0,0 +1,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() | 
