X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=naja%2Ftests%2Ftest_actions.py;h=d770f12397f04ffec487192ba299a8445f51a3a1;hb=f3888948332bf41795fcfd0a84bf0700abf3f0ab;hp=14d5f0e6e2f8efd56b3f926c510ce94ea2003dfe;hpb=a455a8ce46afe31f217e0a8fe8d0247d28eed8ad;p=naja.git diff --git a/naja/tests/test_actions.py b/naja/tests/test_actions.py index 14d5f0e..d770f12 100644 --- a/naja/tests/test_actions.py +++ b/naja/tests/test_actions.py @@ -2,11 +2,15 @@ from unittest import TestCase from naja.constants import BITS, MOVES from naja.gameboard import GameBoard, LocationCard +from naja.options import parse_args from naja.player import Player from naja import actions class TestActions(TestCase): + def setUp(self): + parse_args([]) + def make_player(self, *bits): player_bits = 0 for bit in bits: @@ -16,7 +20,7 @@ class TestActions(TestCase): def make_board(self, player_bits=None, locations=None): if locations is None: locations = [{'actions': []}] - board = GameBoard.new_game(locations) + board = GameBoard.new_game({'cards': locations}) if player_bits is not None: board.player.bits.bits = 0 board.player.bits.set_bits(player_bits) @@ -190,17 +194,21 @@ class TestActions(TestCase): def test_AllowKnightMove(self): board = self.make_board(player_bits=[BITS.RED, BITS.BLUE]) - actions.AllowChessMove(set([BITS.RED, BITS.BLUE]), chesspiece="KNIGHT").perform_action(board, None) + actions.AllowChessMove( + set([BITS.RED, BITS.BLUE]), chesspiece="KNIGHT" + ).perform_action(board, None) self.assertEqual(board.player.movement_mode, MOVES.KNIGHT) - def test_AllowBishopMove(self): board = self.make_board(player_bits=[BITS.RED, BITS.BLUE]) - actions.AllowChessMove(set([BITS.RED, BITS.BLUE]), chesspiece="BISHOP").perform_action(board, None) + actions.AllowChessMove( + set([BITS.RED, BITS.BLUE]), chesspiece="BISHOP" + ).perform_action(board, None) self.assertEqual(board.player.movement_mode, MOVES.BISHOP) - def test_AllowCastleMove(self): board = self.make_board(player_bits=[BITS.RED, BITS.BLUE]) - actions.AllowChessMove(set([BITS.RED, BITS.BLUE]), chesspiece="CASTLE").perform_action(board, None) + actions.AllowChessMove( + set([BITS.RED, BITS.BLUE]), chesspiece="CASTLE" + ).perform_action(board, None) self.assertEqual(board.player.movement_mode, MOVES.CASTLE)