def test_whenNextBoardIsFinishedThenAnyBoardCanBePlayed(): main_board = MainBoard() #Force some sub_board plays to finish a board finished_sub_board = main_board._board[2][2]\ .add_my_move(Move(0, 0))\ .add_my_move(Move(1, 1))\ .add_my_move(Move(2, 2)) #Set that sub-board where the next_board_coords will be main_board._board[2][2] = finished_sub_board #Play a move that will make the finished board the next board (Move 2, 2) main_board = main_board.add_my_move(BoardCoords(0, 0), Move(2, 2)) #Playing anywhere is now allowed assert main_board.next_board_coords == None assert main_board.is_valid_board_for_next_move(BoardCoords(1, 1)) == True main_board.add_opponent_move(BoardCoords(0, 0), Move(1, 1))
def test_whenNewMoveIsNotOnGameNextBoardThenExceptionRaised(): board = MainBoard().add_my_move(BoardCoords(0, 0), Move(1, 1)) #Move must now be on board at 1, 1 with pytest.raises(MoveNotOnNextBoardError): board.add_opponent_move(BoardCoords(1, 0), Move(1, 1))