From 3868fb1e0622e5d3cda0c093ce3114c485fd0096 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sat, 9 Nov 2013 15:45:03 -0600 Subject: 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. --- tests/test_vba_battle.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/test_vba_battle.py (limited to 'tests/test_vba_battle.py') 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() -- cgit v1.2.3