X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=naja%2Ftests%2Ftest_gameboard.py;h=f8672b45d149aad1bd8a719f1d8f2d61229808c7;hb=b672949475f81700075633c7ce82b5bb7900c60e;hp=a72505a5d415efa0abd130c2bc5b3294db52d6c4;hpb=b3b73fb5e200a9cc39edb4d4d7ffaa7c3035ee46;p=naja.git diff --git a/naja/tests/test_gameboard.py b/naja/tests/test_gameboard.py index a72505a..f8672b4 100644 --- a/naja/tests/test_gameboard.py +++ b/naja/tests/test_gameboard.py @@ -32,14 +32,14 @@ class TestGameBoard(TestCase): def test_export_new_board(self): board = GameBoard.new_game({'cards': [ {'card_name': 'card1', 'actions': [ - { - 'action_class': 'LoseHealthOrMSB', - 'required_bits': [], - }, { - 'action_class': 'GainHealth', - 'required_bits': [BITS.RED], - }, - ]}]}) + { + 'action_class': 'LoseHealthOrMSB', + 'required_bits': [], + }, { + 'action_class': 'GainHealth', + 'required_bits': [BITS.RED], + }, + ]}]}) exported_state = board.export() board_locations = exported_state.pop('board_locations') self.assertEqual(exported_state, { @@ -59,13 +59,15 @@ class TestGameBoard(TestCase): 'player': board.player.export(), 'puzzle': False, 'player_mode': EXAMINE, + 'replacement_params': None, + 'clock_count': 0, }) positions = [] for position, location_state in board_locations: positions.append(position) - self.assertEqual( - sorted(location_state.keys()), ['actions', 'bitwise_operand', - 'card_name', 'max_number']) + self.assertEqual(sorted(location_state.keys()), [ + 'actions', 'bitwise_operand', 'card_name', 'max_number', + 'replacement_time']) self.assertEqual(location_state['actions'], [ { 'action_class': 'LoseHealthOrMSB', @@ -329,19 +331,32 @@ class TestLocationCard(TestCase): self.assertEqual(bits, set(BITS.values())) def test_new_location_no_actions(self): - location = LocationCard.new_location({'card_name': 'card', - 'actions': []}) + location = LocationCard.new_location( + {'card_name': 'card', 'actions': []}, None) + [action] = location.actions + self.assertEqual(type(action), actions.DoNothing) + self.assertEqual(action.required_bits, set()) + self.assertEqual(location.replacement_time, None) + + def test_new_location_replacement_params(self): + location = LocationCard.new_location( + {'card_name': 'card', 'actions': []}, + {'chance': 1, 'min': 2, 'max': 2}) [action] = location.actions self.assertEqual(type(action), actions.DoNothing) self.assertEqual(action.required_bits, set()) + self.assertEqual(location.replacement_time, 2) def test_new_location_one_action(self): - location = LocationCard.new_location({'card_name': 'card1', - 'actions': [{'required_bits': [], 'action_class': 'DoNothing'}, - ]}) + location = LocationCard.new_location({ + 'card_name': 'card1', + 'actions': [ + {'required_bits': [], 'action_class': 'DoNothing'}, + ]}, None) [action] = location.actions self.assertEqual(type(action), actions.DoNothing) self.assertEqual(action.required_bits, set()) + self.assertEqual(location.replacement_time, None) def test_parse_bits(self): self.assertEqual(