def test_check_word_on_board(self): """Is word on board?""" board = BoggleBoard(3) # fill board with exact setup so we can test word finding board[0] = ['C', 'X', 'X'] board[1] = ['A', 'T', 'X'] board[2] = ['D', 'O', 'G'] self.assertTrue(board.check_word_on_board("CAT")) self.assertTrue(board.check_word_on_board("DOG")) self.assertFalse(board.check_word_on_board("PET"))
def test_initializer(self): """Test board was created successfully.""" board = BoggleBoard(3) self.assertTrue( all(all(cell in ascii_uppercase for cell in row) for row in board)) # Make sure each row is a separate list, now a copy of another row! self.assertTrue(board[0] is not board[1])
def homepage(): """Show board.""" # get a unique identifier for the board we're creating uuid = uuid4() board = BoggleBoard() boards[uuid] = board # store the uuid for the board in the session so that later requests can # find it session[SESS_BOARD_UUID_KEY] = uuid return render_template("index.html", board_in_template=board)
def homepage(): """Show board.""" # get a unique identifier for the board we're creating uuid = uuid4() # an instance of the class BoggleBoard - We pass this into the render_template board = BoggleBoard() # the unique uuid serves as the key in the global dictionary boards, while our instance of the BoggleBoard class serves as the value boards[uuid] = board # store the uuid for the board in the session so that later requests can # find it session[SESS_BOARD_UUID_KEY] = uuid return render_template("index.html", board=board)
def homepage(): """Show board.""" # get a unique identifier for the board we're creating uuid = uuid4() board = BoggleBoard() # print (f"created board {board}") boards[uuid] = board # print (f"saving board{boards}") # print (f"one board in boardslist {boards[uuid]}") # store the uuid for the board in the session so that later requests can # find it session[SESS_BOARD_UUID_KEY] = uuid return render_template("index.html", board=board)